Skip to content

Commit

Permalink
Rollup merge of rust-lang#65617 - newpavlov:patch-2, r=alexcrichton
Browse files Browse the repository at this point in the history
Fix WASI sleep impl

Closes rust-lang#65607

@sunfishcode
Is it fine to use 0 for the `identifier` field? What is this field used for?
  • Loading branch information
JohnTitor authored Oct 23, 2019
2 parents 6f6f3e8 + 1e2b711 commit ff2442f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libstd/sys/wasi/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ 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,
flags: 0,
};

let in_ = [wasi::Subscription {
userdata: 0,
userdata: USERDATA,
type_: wasi::EVENTTYPE_CLOCK,
u: wasi::raw::__wasi_subscription_u { clock: clock },
}];
Expand All @@ -53,7 +53,7 @@ impl Thread {
};
match (res, event) {
(Ok(1), wasi::Event {
userdata: CLOCK_ID,
userdata: USERDATA,
error: 0,
type_: wasi::EVENTTYPE_CLOCK,
..
Expand Down

0 comments on commit ff2442f

Please sign in to comment.