mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 03:38:31 +00:00
Improve Windows sleep accuracy from 15ms to 15µs
This commit is contained in:
parent
b40140e6c5
commit
b490e23d63
16 changed files with 189 additions and 67 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "libc/calls/sig.internal.h"
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/calls/struct/sigset.internal.h"
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
|
@ -59,8 +60,7 @@ int sigsuspend(const sigset_t *ignore) {
|
|||
// using SetEvent() whereas it takes ~30us to use SuspendThread(),
|
||||
// GetThreadContext(), SetThreadContext(), and ResumeThread().
|
||||
BLOCK_SIGNALS;
|
||||
while (!(rc = _park_norestart(-1u, waitmask)))
|
||||
donothing;
|
||||
rc = _park_norestart(timespec_max, waitmask);
|
||||
ALLOW_SIGNALS;
|
||||
} else {
|
||||
rc = sys_sigsuspend((uint64_t[2]){waitmask}, 8);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue