mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
Fixes doc comment of Futex.wait
On Windows, changing the value at the target address is not sufficient, there needs to be a wake call. From [MSDN](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress): > If the value at Address differs from the value at CompareAddress, the function returns immediately. If the values are the same, the function does not return until another thread in the same process signals that the value at Address has changed by calling WakeByAddressSingle or WakeByAddressAll or the timeout elapses, whichever comes first. We could note that this behavior is only observed on Windows. However, if we want the function to have consistent behavior across all platforms, we should require users to call wake. On platforms where changing the value is sufficient to wake the waiting thread, an unblocking of the thread without a matching wake would just be considered a spurious wake.
This commit is contained in:
committed by
Andrew Kelley
parent
9db3e23e80
commit
ef77cc0de1
@@ -20,8 +20,7 @@ const testing = std.testing;
|
||||
const atomic = std.atomic;
|
||||
|
||||
/// Checks if `ptr` still contains the value `expect` and, if so, blocks the caller until either:
|
||||
/// - The value at `ptr` is no longer equal to `expect`.
|
||||
/// - The caller is unblocked by a matching `wake()`.
|
||||
/// - The value at `ptr` is no longer equal to `expect` and `wake()` is called on the same address.
|
||||
/// - The caller is unblocked spuriously ("at random").
|
||||
///
|
||||
/// The checking of `ptr` and `expect`, along with blocking the caller, is done atomically
|
||||
|
||||
Reference in New Issue
Block a user