mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Don't preempt WIN32 libraries
This change refactors our POSIX signals emulation for Windows so that it performs some additional safety checks before calling SetThreadContext() which needs to be locked and must never ever interrupt Microsoft's code. Kudos to the the Go developers for figuring out how to do this properly.
This commit is contained in:
parent
d1a283a588
commit
aca2261cda
5 changed files with 61 additions and 30 deletions
|
@ -48,8 +48,11 @@ static textwindows int _park_thread(uint32_t msdelay, sigset_t waitmask,
|
|||
if ((rc = _check_cancel()) != -1 && (rc = _check_signal(restartable)) != -1) {
|
||||
unassert((wi = WaitForSingleObject(sem, msdelay)) != -1u);
|
||||
if (wi != kNtWaitTimeout) {
|
||||
_check_signal(false);
|
||||
rc = eintr();
|
||||
_check_cancel();
|
||||
} else if ((rc = _check_signal(restartable))) {
|
||||
_check_cancel();
|
||||
}
|
||||
}
|
||||
__sig_finishwait(om);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue