https://bugs.winehq.org/show_bug.cgi?id=50292
--- Comment #2 from Rémi Bernon rbernon@codeweavers.com ---
In 0006-ntdll-Implement-thread-id-alerts-on-top-of-futexes-i.patch
while (!InterlockedExchange( futex, 0 )){if (timeout){LONGLONG timeleft = update_timeout( end );struct timespec timespec;timespec.tv_sec = timeleft / (ULONGLONG)TICKSPERSEC;timespec.tv_nsec = (timeleft % TICKSPERSEC) * 100;ret = futex_wait( futex, 0, ×pec );}elseret = futex_wait( futex, 0, NULL );if (ret == -1 && errno == ETIMEDOUT) return STATUS_TIMEOUT;}
If FUTEX_WAIT_BITSET is available, I think you can use it to wait with an absolute timeout, which could save calls to NtQuerySystemTime.