Skip to content

Commit bf20cb2

Browse files
committed
shims: adjust WaitOnAddress usage on Windows
We would previously unconditionally wait indefinitely on the address rather than waiting for the specified duration. Adjust the timeout parameter to the `WaitOnAddress` to ensure that we get the correct behaviour.
1 parent 12a60ac commit bf20cb2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/shims/lock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ _dispatch_wait_on_address(uint32_t volatile *_address, uint32_t value,
508508
}
509509
return _dispatch_futex_wait(address, value, NULL, FUTEX_PRIVATE_FLAG);
510510
#elif defined(_WIN32)
511-
return WaitOnAddress(address, &value, sizeof(value), INFINITE) == TRUE;
511+
return WaitOnAddress(address, &value, sizeof(value),
512+
nsecs == DISPATCH_TIME_FOREVER ? INFINITE : nsecs / 100000) == TRUE;
512513
#else
513514
#error _dispatch_wait_on_address unimplemented for this platform
514515
#endif

0 commit comments

Comments
 (0)