forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#2764 - DebugSteven:sleep, r=oli-obk
Implement epoll_wait This PR continues working on rust-lang/miri#602. This is an implementation for `sleep`, though admittedly not a good one. It just does busy waiting.
- Loading branch information
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