about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/graph.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-01-08 00:52:45 -0500
committerGitHub <noreply@github.com>2025-01-08 00:52:45 -0500
commit5ed1fa84a50d6af682fbd3c1d0b455e87f959924 (patch)
treecd5faa5f443bf558e4494391b404d002eea5d345 /compiler/rustc_mir_transform/src/coverage/graph.rs
parente7ee58243a53eacd5f20a668bf096f87bd45c984 (diff)
parent45c7ddfea6ba9980a1c6f4f9bd9c821e56af035e (diff)
downloadrust-5ed1fa84a50d6af682fbd3c1d0b455e87f959924.tar.gz
rust-5ed1fa84a50d6af682fbd3c1d0b455e87f959924.zip
Rollup merge of #134389 - rust-wasi-web:condvar-no-threads, r=m-ou-se
Condvar: implement wait_timeout for targets without threads

This always falls back to sleeping since there is no way to notify a condvar on a target without threads.

Even on a target that has no threads the following code is a legitimate use case:

```rust
use std::sync::{Condvar, Mutex};
use std::time::Duration;

fn main() {
    let cv = Condvar::new();
    let mutex = Mutex::new(());
    let mut guard = mutex.lock().unwrap();

    cv.notify_one();

    let res;
    (guard, res) = cv.wait_timeout(guard, Duration::from_secs(3)).unwrap();
    assert!(res.timed_out());
}
```
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/graph.rs')
0 files changed, 0 insertions, 0 deletions