Skip to content

Commit 13f166a

Browse files
committed
Add comment documenting NtWaitForKeyedEvent's timeout interpretation.
1 parent 43f844b commit 13f166a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

library/std/src/sys/windows/thread_parker.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ impl Parker {
158158
// Need to wait for unpark() using NtWaitForKeyedEvent.
159159
let handle = keyed_event_handle();
160160

161-
// NtWaitForKeyedEvent uses a unit of 100ns, and uses negative values
162-
// to indicate the monotonic clock.
161+
// NtWaitForKeyedEvent uses a unit of 100ns, and uses negative
162+
// values to indicate a relative time on the monotonic clock.
163+
// This is documented here for the underlying KeWaitForSingleObject function:
164+
// https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kewaitforsingleobject
163165
let mut timeout = match i64::try_from((timeout.as_nanos() + 99) / 100) {
164166
Ok(t) => -t,
165167
Err(_) => i64::MIN,

0 commit comments

Comments
 (0)