diff options
Diffstat (limited to 'spec/ruby/core/mutex/lock_spec.rb')
-rw-r--r-- | spec/ruby/core/mutex/lock_spec.rb | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/spec/ruby/core/mutex/lock_spec.rb b/spec/ruby/core/mutex/lock_spec.rb index a272b16a32..a1a2972d8c 100644 --- a/spec/ruby/core/mutex/lock_spec.rb +++ b/spec/ruby/core/mutex/lock_spec.rb @@ -11,22 +11,15 @@ describe "Mutex#lock" do m.unlock end - it "waits if the lock is not available" do + it "blocks the caller if already locked" do m = Mutex.new - m.lock + lambda { m.lock }.should block_caller + end - th = Thread.new do - m.lock - ScratchPad.record :after_lock - end - - Thread.pass while th.status and th.status != "sleep" - - ScratchPad.recorded.should be_nil - m.unlock - th.join - ScratchPad.recorded.should == :after_lock + it "does not block the caller if not locked" do + m = Mutex.new + lambda { m.lock }.should_not block_caller end # Unable to find a specific ticket but behavior change may be |