@@ -242,14 +242,14 @@ def wait_up_to(secs, &condition)
242242in_thread { lock . acquire_read_lock ; latch1 . count_down ; latch2 . wait ; lock . release_read_lock } ,
243243in_thread { latch1 . wait ; lock . acquire_write_lock ; good . value = true }
244244]
245- wait_up_to ( 0.2 ) { threads [ 3 ] . status == 'sleep' }
245+ wait_up_to ( 0.5 ) { threads [ 3 ] . status == 'sleep' }
246246# The last thread should be waiting to acquire a write lock now...
247247expect ( threads [ 3 ] . status ) . to eql "sleep"
248248expect ( threads [ 3 ] ) . not_to hold ( lock ) . for_write
249249expect ( good . value ) . to be false
250250# Throw latch2 and the 3 readers will wake up and all release their read locks...
251251latch2 . count_down
252- wait_up_to ( 0.2 ) { good . value }
252+ wait_up_to ( 0.5 ) { good . value }
253253expect ( threads [ 3 ] ) . to hold ( lock ) . for_write
254254expect ( good . value ) . to be true
255255end
@@ -265,7 +265,7 @@ def wait_up_to(secs, &condition)
265265expect { Timeout . timeout ( 1 ) { threads [ 0 ] . join } } . not_to raise_error
266266expect ( threads [ 0 ] ) . to hold ( lock ) . for_write
267267expect ( threads [ 1 ] ) . not_to hold ( lock ) . for_write
268- wait_up_to ( 0.2 ) { threads [ 1 ] . status == 'sleep' }
268+ wait_up_to ( 0.5 ) { threads [ 1 ] . status == 'sleep' }
269269expect ( threads [ 1 ] . status ) . to eql "sleep"
270270end
271271
@@ -278,7 +278,7 @@ def wait_up_to(secs, &condition)
278278expect { Timeout . timeout ( 1 ) { threads [ 0 ] . join } } . not_to raise_error
279279expect ( threads [ 0 ] ) . to hold ( lock ) . for_read
280280expect ( threads [ 1 ] ) . not_to hold ( lock ) . for_write
281- wait_up_to ( 0.2 ) { threads [ 1 ] . status == 'sleep' }
281+ wait_up_to ( 0.5 ) { threads [ 1 ] . status == 'sleep' }
282282expect ( threads [ 1 ] . status ) . to eql "sleep"
283283end
284284
@@ -341,15 +341,15 @@ def wait_up_to(secs, &condition)
341341in_thread { latch1 . wait ; lock . acquire_read_lock ; good . update { |n | n +1 } } ,
342342in_thread { latch1 . wait ; lock . acquire_read_lock ; good . update { |n | n +1 } }
343343]
344- wait_up_to ( 0.2 ) { threads [ 3 ] . status == 'sleep' }
344+ wait_up_to ( 0.5 ) { threads [ 3 ] . status == 'sleep' }
345345# The last 3 threads should be waiting to acquire read locks now...
346346unless Concurrent . on_jruby? # flaky on JRuby
347347( 1 ..3 ) . each { |n | expect ( threads [ n ] . status ) . to eql "sleep" }
348348end
349349( 1 ..3 ) . each { |n | expect ( threads [ n ] ) . not_to hold ( lock ) . for_read }
350350# Throw latch2 and the writer will wake up and release its write lock...
351351latch2 . count_down
352- wait_up_to ( 0.2 ) { good . value == 3 }
352+ wait_up_to ( 0.5 ) { good . value == 3 }
353353( 1 ..3 ) . each { |n | expect ( threads [ n ] ) . to hold ( lock ) . for_read }
354354end
355355
@@ -360,15 +360,15 @@ def wait_up_to(secs, &condition)
360360in_thread { lock . acquire_write_lock ; latch1 . count_down ; latch2 . wait ; lock . release_write_lock } ,
361361in_thread { latch1 . wait ; lock . acquire_write_lock ; good . value = true } ,
362362]
363- wait_up_to ( 0.2 ) { threads [ 1 ] . status == 'sleep' }
363+ wait_up_to ( 0.5 ) { threads [ 1 ] . status == 'sleep' }
364364# The last thread should be waiting to acquire a write lock now...
365365unless Concurrent . on_jruby? # flaky on JRuby
366366expect ( threads [ 1 ] . status ) . to eql "sleep"
367367end
368368expect ( threads [ 1 ] ) . not_to hold ( lock ) . for_write
369369# Throw latch2 and the writer will wake up and release its write lock...
370370latch2 . count_down
371- wait_up_to ( 0.2 ) { good . value }
371+ wait_up_to ( 0.5 ) { good . value }
372372expect ( threads [ 1 ] ) . to hold ( lock ) . for_write
373373end
374374end
0 commit comments