about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-10-23 17:14:36 +0900
committerGitHub <noreply@github.com>2019-10-23 17:14:36 +0900
commitff2442ff36a5ddb8a2b6ae737b2acb5c9718c04e (patch)
tree1bb6f7bac7d7a2dab9d65a40d6e8d58538d624fd /src/libstd
parent6f6f3e8cd72de9f41de2c3cf5f1c165eb6b3960d (diff)
parent1e2b711d308be714e6211c125b1a33ac1247f866 (diff)
downloadrust-ff2442ff36a5ddb8a2b6ae737b2acb5c9718c04e.tar.gz
rust-ff2442ff36a5ddb8a2b6ae737b2acb5c9718c04e.zip
Rollup merge of #65617 - newpavlov:patch-2, r=alexcrichton
Fix WASI sleep impl

Closes #65607

@sunfishcode
Is it fine to use 0 for the `identifier` field? What is this field used for?
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sys/wasi/thread.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys/wasi/thread.rs b/src/libstd/sys/wasi/thread.rs
index 28a504f1979..6ce41420284 100644
--- a/src/libstd/sys/wasi/thread.rs
+++ b/src/libstd/sys/wasi/thread.rs
@@ -31,10 +31,10 @@ impl Thread {
         let nanos = dur.as_nanos();
         assert!(nanos <= u64::max_value() as u128);
 
-        const CLOCK_ID: wasi::Userdata = 0x0123_45678;
+        const USERDATA: wasi::Userdata = 0x0123_45678;
 
         let clock = wasi::raw::__wasi_subscription_u_clock_t {
-            identifier: CLOCK_ID,
+            identifier: 0,
             clock_id: wasi::CLOCK_MONOTONIC,
             timeout: nanos as u64,
             precision: 0,
@@ -42,7 +42,7 @@ impl Thread {
         };
 
         let in_ = [wasi::Subscription {
-            userdata: 0,
+            userdata: USERDATA,
             type_: wasi::EVENTTYPE_CLOCK,
             u: wasi::raw::__wasi_subscription_u { clock: clock },
         }];
@@ -53,7 +53,7 @@ impl Thread {
         };
         match (res, event) {
             (Ok(1), wasi::Event {
-                userdata: CLOCK_ID,
+                userdata: USERDATA,
                 error: 0,
                 type_: wasi::EVENTTYPE_CLOCK,
                 ..