Permalink
Browse files

add failing test for race condition between ConditionVariable and timer

  • Loading branch information...
1 parent 924bdbb commit 3512d60d033953012d16dbd2149adecc4a984667 @funny-falcon funny-falcon committed Mar 14, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 spec/thread_spec.rb
View
17 spec/thread_spec.rb
@@ -170,5 +170,22 @@
end
i.should == 'ping-pong'
end
+ it 'should not raise, when timer wakes up fiber between `signal` and `next_tick`' do
+ proc {
+ EM.synchrony do
+ f = Fiber.new do
+ m.synchronize do
+ c.wait(m, 0.0001)
+ end
+ EM.add_timer(0.001){ EM.stop }
+ end
+ i = 0
+ f.resume
+ EM.next_tick{
+ c.signal
+ }
+ end
+ }.should_not raise_error
+ end
end
end

0 comments on commit 3512d60

Please sign in to comment.