@@ -35,7 +35,7 @@ fn check_conditional_variables_notify_one() {
35
35
let pair2 = pair. clone ( ) ;
36
36
37
37
// Spawn a new thread.
38
- thread:: spawn ( move || {
38
+ let t = thread:: spawn ( move || {
39
39
thread:: yield_now ( ) ;
40
40
let ( lock, cvar) = & * pair2;
41
41
let mut started = lock. lock ( ) . unwrap ( ) ;
@@ -50,6 +50,8 @@ fn check_conditional_variables_notify_one() {
50
50
while !* started {
51
51
started = cvar. wait ( started) . unwrap ( ) ;
52
52
}
53
+
54
+ t. join ( ) . unwrap ( ) ;
53
55
}
54
56
55
57
/// Test that waiting on a conditional variable with a timeout does not
@@ -191,51 +193,6 @@ fn check_once() {
191
193
}
192
194
}
193
195
194
- fn check_rwlock_unlock_bug1 ( ) {
195
- // There was a bug where when un-read-locking an rwlock that still has other
196
- // readers waiting, we'd accidentally also let a writer in.
197
- // That caused an ICE.
198
- let l = Arc :: new ( RwLock :: new ( 0 ) ) ;
199
-
200
- let r1 = l. read ( ) . unwrap ( ) ;
201
- let r2 = l. read ( ) . unwrap ( ) ;
202
-
203
- // Make a waiting writer.
204
- let l2 = l. clone ( ) ;
205
- thread:: spawn ( move || {
206
- let mut w = l2. write ( ) . unwrap ( ) ;
207
- * w += 1 ;
208
- } ) ;
209
- thread:: yield_now ( ) ;
210
-
211
- drop ( r1) ;
212
- assert_eq ! ( * r2, 0 ) ;
213
- thread:: yield_now ( ) ;
214
- thread:: yield_now ( ) ;
215
- thread:: yield_now ( ) ;
216
- assert_eq ! ( * r2, 0 ) ;
217
- drop ( r2) ;
218
- }
219
-
220
- fn check_rwlock_unlock_bug2 ( ) {
221
- // There was a bug where when un-read-locking an rwlock by letting the last reader leaver,
222
- // we'd forget to wake up a writer.
223
- // That meant the writer thread could never run again.
224
- let l = Arc :: new ( RwLock :: new ( 0 ) ) ;
225
-
226
- let r = l. read ( ) . unwrap ( ) ;
227
-
228
- // Make a waiting writer.
229
- let l2 = l. clone ( ) ;
230
- let h = thread:: spawn ( move || {
231
- let _w = l2. write ( ) . unwrap ( ) ;
232
- } ) ;
233
- thread:: yield_now ( ) ;
234
-
235
- drop ( r) ;
236
- h. join ( ) . unwrap ( ) ;
237
- }
238
-
239
196
fn park_timeout ( ) {
240
197
let start = Instant :: now ( ) ;
241
198
@@ -277,8 +234,6 @@ fn main() {
277
234
check_rwlock_write ( ) ;
278
235
check_rwlock_read_no_deadlock ( ) ;
279
236
check_once ( ) ;
280
- check_rwlock_unlock_bug1 ( ) ;
281
- check_rwlock_unlock_bug2 ( ) ;
282
237
park_timeout ( ) ;
283
238
park_unpark ( ) ;
284
239
check_condvar ( ) ;
0 commit comments