Skip to content

Commit 5ac2971

Browse files
authored
Merge pull request #252 from fusion-engineering-forks/miri-issues
2 parents 7421889 + 1f8df37 commit 5ac2971

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.github/workflows/rust.yml

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ jobs:
4242
- wasm32-unknown-unknown
4343
- x86_64-fortanix-unknown-sgx
4444
#- x86_64-unknown-redox
45-
- x86_64-unknown-cloudabi
4645
#- x86_64-linux-android
4746
steps:
4847
- uses: actions/checkout@v2

src/condvar.rs

+3
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,9 @@ mod tests {
663663
while !c.notify_one() {
664664
// Wait for the thread to get into wait()
665665
MutexGuard::bump(&mut g);
666+
// Yield, so the other thread gets a chance to do something.
667+
// (At least Miri needs this, because it doesn't preempt threads.)
668+
thread::yield_now();
666669
}
667670
// The thread should have been requeued to the mutex, which we wake up now.
668671
drop(g);

src/rwlock.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ mod tests {
539539
fn test_rwlock_recursive() {
540540
let arc = Arc::new(RwLock::new(1));
541541
let arc2 = arc.clone();
542-
let _lock1 = arc.read();
543-
thread::spawn(move || {
542+
let lock1 = arc.read();
543+
let t = thread::spawn(move || {
544544
let _lock = arc2.write();
545545
});
546546

@@ -554,7 +554,12 @@ mod tests {
554554
}
555555

556556
// A normal read would block here since there is a pending writer
557-
let _lock2 = arc.read_recursive();
557+
let lock2 = arc.read_recursive();
558+
559+
// Unblock the thread and join it.
560+
drop(lock1);
561+
drop(lock2);
562+
t.join().unwrap();
558563
}
559564

560565
#[test]

0 commit comments

Comments
 (0)