mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +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
|
@ -164,12 +164,12 @@ static noasan int Munmap(char *p, size_t n) {
|
|||
noasan int munmap(void *p, size_t n) {
|
||||
int rc;
|
||||
size_t toto;
|
||||
_spinlock(&_mmi.lock);
|
||||
__mmi_lock();
|
||||
rc = Munmap(p, n);
|
||||
#if SYSDEBUG
|
||||
toto = __strace > 0 ? GetMemtrackSize(&_mmi) : 0;
|
||||
#endif
|
||||
_spunlock(&_mmi.lock);
|
||||
__mmi_unlock();
|
||||
STRACE("munmap(%.12p, %'zu) → %d% m (%'zu bytes total)", p, n, rc, toto);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue