Disable test on 1.8.7, since workaround is to allow blocking on that version
This commit is contained in:
		
							parent
							
								
									d2f8af03eb
								
							
						
					
					
						commit
						90a9f37da4
					
				|  | @ -158,35 +158,37 @@ module ProcessShared | |||
|         end | ||||
|       end | ||||
| 
 | ||||
|       it 'allows other threads in a process to continue while waiting' do | ||||
|         start = Time.now.to_f | ||||
|         sem = Semaphore.new | ||||
|         was_set = false | ||||
|         t2 = nil | ||||
|       unless RUBY_VERSION == '1.8.7' | ||||
|         it 'allows other threads in a process to continue while waiting' do | ||||
|           start = Time.now.to_f | ||||
|           sem = Semaphore.new | ||||
|           was_set = false | ||||
|           t2 = nil | ||||
| 
 | ||||
|         sem.synchronize do | ||||
|           t1 = Thread.new do | ||||
|             # give t2 a chance to wait on the lock, then set the flag | ||||
|             sleep 0.01 | ||||
|             was_set = true | ||||
|           end | ||||
| 
 | ||||
|           t2 = Thread.new do | ||||
|             begin | ||||
|               sem.try_wait(10.0) | ||||
|             rescue Errno::ETIMEDOUT | ||||
|               # success | ||||
|           sem.synchronize do | ||||
|             t1 = Thread.new do | ||||
|               # give t2 a chance to wait on the lock, then set the flag | ||||
|               sleep 0.01 | ||||
|               was_set = true | ||||
|             end | ||||
| 
 | ||||
|             t2 = Thread.new do | ||||
|               begin | ||||
|                 sem.try_wait(10.0) | ||||
|               rescue Errno::ETIMEDOUT | ||||
|                 # success | ||||
|               end | ||||
|             end | ||||
| 
 | ||||
|             # t1 should set the flag and die while t2 is still waiting on the lock | ||||
|             t1.join | ||||
|           end | ||||
| 
 | ||||
|           # t1 should set the flag and die while t2 is still waiting on the lock | ||||
|           t1.join | ||||
|           was_set.must_equal true | ||||
|           (Time.now.to_f - start).must be_lt(0.1) | ||||
| 
 | ||||
|           t2.join | ||||
|         end | ||||
| 
 | ||||
|         was_set.must_equal true | ||||
|         (Time.now.to_f - start).must be_lt(0.1) | ||||
| 
 | ||||
|         t2.join | ||||
|       end | ||||
|     end | ||||
|   end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue