mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 07:18:30 +00:00
Make locks more reliable
This change switches most of the core locks to be re-entrant, in order to reduce the chance of deadlocking code that does, clever things with asynchronous signal handlers. This change implements it it in pthreads so we're one step closer to having a standardized threading primitives
This commit is contained in:
parent
5ea618f0af
commit
c260345e06
35 changed files with 369 additions and 258 deletions
|
@ -29,7 +29,7 @@ textwindows int sys_mprotect_nt(void *addr, size_t size, int prot) {
|
|||
unsigned i;
|
||||
uint32_t op;
|
||||
char *a, *b, *x, *y, *p;
|
||||
_spinlock(&_mmi.lock);
|
||||
__mmi_lock();
|
||||
p = addr;
|
||||
i = FindMemoryInterval(&_mmi, (intptr_t)p >> 16);
|
||||
if (i == _mmi.i || (!i && p + size <= ADDR(_mmi.p[0].x))) {
|
||||
|
@ -58,6 +58,6 @@ textwindows int sys_mprotect_nt(void *addr, size_t size, int prot) {
|
|||
}
|
||||
}
|
||||
}
|
||||
_spunlock(&_mmi.lock);
|
||||
__mmi_unlock();
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue