File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 42
42
- wasm32-unknown-unknown
43
43
- x86_64-fortanix-unknown-sgx
44
44
# - x86_64-unknown-redox
45
- - x86_64-unknown-cloudabi
46
45
# - x86_64-linux-android
47
46
steps :
48
47
- uses : actions/checkout@v2
Original file line number Diff line number Diff line change @@ -663,6 +663,9 @@ mod tests {
663
663
while !c. notify_one ( ) {
664
664
// Wait for the thread to get into wait()
665
665
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 ( ) ;
666
669
}
667
670
// The thread should have been requeued to the mutex, which we wake up now.
668
671
drop ( g) ;
Original file line number Diff line number Diff line change @@ -539,8 +539,8 @@ mod tests {
539
539
fn test_rwlock_recursive ( ) {
540
540
let arc = Arc :: new ( RwLock :: new ( 1 ) ) ;
541
541
let arc2 = arc. clone ( ) ;
542
- let _lock1 = arc. read ( ) ;
543
- thread:: spawn ( move || {
542
+ let lock1 = arc. read ( ) ;
543
+ let t = thread:: spawn ( move || {
544
544
let _lock = arc2. write ( ) ;
545
545
} ) ;
546
546
@@ -554,7 +554,12 @@ mod tests {
554
554
}
555
555
556
556
// 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 ( ) ;
558
563
}
559
564
560
565
#[ test]
You can’t perform that action at this time.
0 commit comments