mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Write more tests for signal handling
There's now a much stronger level of assurance that signaling on Windows will be atomic, low-latency, low tail latency, and shall never deadlock.
This commit is contained in:
parent
0e59afb403
commit
dd8c4dbd7d
19 changed files with 407 additions and 75 deletions
|
@ -53,8 +53,15 @@ int sigsuspend(const sigset_t *ignore) {
|
|||
} else {
|
||||
sigset_t waitmask = ignore ? *ignore : 0;
|
||||
if (IsWindows() || IsMetal()) {
|
||||
// we don't strictly need to block signals, but it reduces signal
|
||||
// delivery latency, by preventing other threads from delivering a
|
||||
// signal asynchronously. it takes about ~5us to deliver a signal
|
||||
// using SetEvent() whereas it takes ~30us to use SuspendThread(),
|
||||
// GetThreadContext(), SetThreadContext(), and ResumeThread().
|
||||
BLOCK_SIGNALS;
|
||||
while (!(rc = _park_norestart(-1u, waitmask)))
|
||||
donothing;
|
||||
ALLOW_SIGNALS;
|
||||
} else {
|
||||
rc = sys_sigsuspend((uint64_t[2]){waitmask}, 8);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue