mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* test/monitor/test_monitor.rb (test_cond): use Queue#deq
insteadof sleep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									e5d803e671
								
							
						
					
					
						commit
						2a3f367151
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -113,8 +113,9 @@ class TestMonitor < Test::Unit::TestCase
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    c = "foo"
 | 
			
		||||
    queue3 = Queue.new
 | 
			
		||||
    Thread.start do
 | 
			
		||||
      sleep(0.2)
 | 
			
		||||
      queue3.deq
 | 
			
		||||
      @monitor.synchronize do
 | 
			
		||||
        c = "bar"
 | 
			
		||||
        cond.signal
 | 
			
		||||
| 
						 | 
				
			
			@ -125,6 +126,7 @@ class TestMonitor < Test::Unit::TestCase
 | 
			
		|||
      result3 = cond.wait(0.1)
 | 
			
		||||
      assert_equal(false, result3)
 | 
			
		||||
      assert_equal("foo", c)
 | 
			
		||||
      queue3.enq(nil)
 | 
			
		||||
      result4 = cond.wait
 | 
			
		||||
      assert_equal(true, result4)
 | 
			
		||||
      assert_equal("bar", c)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue