Skip to content

Commit

Permalink
Merge pull request #252 from fusion-engineering-forks/miri-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanieu committed Oct 3, 2020
2 parents 7421889 + 1f8df37 commit 5ac2971
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion .github/workflows/rust.yml
Expand Up @@ -42,7 +42,6 @@ jobs:
- wasm32-unknown-unknown
- x86_64-fortanix-unknown-sgx
#- x86_64-unknown-redox
- x86_64-unknown-cloudabi
#- x86_64-linux-android
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 3 additions & 0 deletions src/condvar.rs
Expand Up @@ -663,6 +663,9 @@ mod tests {
while !c.notify_one() {
// Wait for the thread to get into wait()
MutexGuard::bump(&mut g);
// Yield, so the other thread gets a chance to do something.
// (At least Miri needs this, because it doesn't preempt threads.)
thread::yield_now();
}
// The thread should have been requeued to the mutex, which we wake up now.
drop(g);
Expand Down
11 changes: 8 additions & 3 deletions src/rwlock.rs
Expand Up @@ -539,8 +539,8 @@ mod tests {
fn test_rwlock_recursive() {
let arc = Arc::new(RwLock::new(1));
let arc2 = arc.clone();
let _lock1 = arc.read();
thread::spawn(move || {
let lock1 = arc.read();
let t = thread::spawn(move || {
let _lock = arc2.write();
});

Expand All @@ -554,7 +554,12 @@ mod tests {
}

// A normal read would block here since there is a pending writer
let _lock2 = arc.read_recursive();
let lock2 = arc.read_recursive();

// Unblock the thread and join it.
drop(lock1);
drop(lock2);
t.join().unwrap();
}

#[test]
Expand Down

0 comments on commit 5ac2971

Please sign in to comment.