diff options
| author | newpavlov <newpavlov@gmail.com> | 2019-08-19 15:36:30 +0300 |
|---|---|---|
| committer | newpavlov <newpavlov@gmail.com> | 2019-08-19 15:36:30 +0300 |
| commit | e5ba80a87c54ab7770d9c300dacd0976f74e563e (patch) | |
| tree | aabd2b753140e7a6717e7a29dd79d69f8cc191ae /src/libstd/sys | |
| parent | 7658a13c650e3dd931250f6039c4f12bcc77534f (diff) | |
| download | rust-e5ba80a87c54ab7770d9c300dacd0976f74e563e.tar.gz rust-e5ba80a87c54ab7770d9c300dacd0976f74e563e.zip | |
use const
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/wasi/thread.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/sys/wasi/thread.rs b/src/libstd/sys/wasi/thread.rs index f9e2433dca0..a6c8f248701 100644 --- a/src/libstd/sys/wasi/thread.rs +++ b/src/libstd/sys/wasi/thread.rs @@ -30,8 +30,10 @@ impl Thread { let nanos = dur.as_nanos(); assert!(nanos <= u64::max_value() as u128); + const CLOCK_ID: wasi::Userdata = 0x0123_45678; + let clock = wasi::raw::__wasi_subscription_u_clock_t { - identifier: 0x0123_45678, + identifier: CLOCK_ID, clock_id: wasi::CLOCK_MONOTONIC, timeout: nanos as u64, precision: 0, @@ -47,7 +49,7 @@ impl Thread { let n = wasi::poll_oneoff(&in_, &mut out).unwrap(); let wasi::Event { userdata, error, type_, .. } = out[0]; match (n, userdata, error) { - (1, 0x0123_45678, 0) if type_ == wasi::EVENTTYPE_CLOCK => {} + (1, CLOCK_ID, 0) if type_ == wasi::EVENTTYPE_CLOCK => {} _ => panic!("thread::sleep(): unexpected result of poll_oneoff"), } } |
