-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
busy waiting implementation for sleep
- Loading branch information
1 parent
0aaa9ea
commit 15b9f45
Showing
5 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//@compile-flags: -Zmiri-disable-isolation -Zmiri-permissive-provenance -Zmiri-backtrace=full | ||
//@only-target-x86_64-unknown-linux: support for tokio only on linux and x86 | ||
|
||
use tokio::time::{sleep, Duration, Instant}; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let start = Instant::now(); | ||
sleep(Duration::from_secs(1)).await; | ||
// It takes 96 millisecond to sleep for 1 millisecond | ||
// It takes 1025 millisecond to sleep for 1 second | ||
let time_elapsed = &start.elapsed().as_millis(); | ||
assert!(time_elapsed > &1000, "{}", time_elapsed); | ||
} |
2 changes: 1 addition & 1 deletion
2
src/tools/miri/tests/pass-dep/tokio_mvp.rs → ...ls/miri/tests/pass-dep/tokio/tokio_mvp.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters