about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2020-10-06 18:40:06 +0200
committerMara Bos <m-ou.se@m-ou.se>2020-10-06 18:41:26 +0200
commit13f166a9e63547689f866bdfdb2147f86fba915c (patch)
tree8478d7a73e5c95fa8b85bd1f60043731d5e70a33
parent43f844b84d1463907e9050fb3cd7f571f43e5e89 (diff)
downloadrust-13f166a9e63547689f866bdfdb2147f86fba915c.tar.gz
rust-13f166a9e63547689f866bdfdb2147f86fba915c.zip
Add comment documenting NtWaitForKeyedEvent's timeout interpretation.
-rw-r--r--library/std/src/sys/windows/thread_parker.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/thread_parker.rs b/library/std/src/sys/windows/thread_parker.rs
index 8f45db78d2f..3311627f170 100644
--- a/library/std/src/sys/windows/thread_parker.rs
+++ b/library/std/src/sys/windows/thread_parker.rs
@@ -158,8 +158,10 @@ impl Parker {
             // Need to wait for unpark() using NtWaitForKeyedEvent.
             let handle = keyed_event_handle();
 
-            // NtWaitForKeyedEvent uses a unit of 100ns, and uses negative values
-            // to indicate the monotonic clock.
+            // NtWaitForKeyedEvent uses a unit of 100ns, and uses negative
+            // values to indicate a relative time on the monotonic clock.
+            // This is documented here for the underlying KeWaitForSingleObject function:
+            // https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-kewaitforsingleobject
             let mut timeout = match i64::try_from((timeout.as_nanos() + 99) / 100) {
                 Ok(t) => -t,
                 Err(_) => i64::MIN,