mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@7a16e01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8e389a0f3
commit
da7976235f
75 changed files with 940 additions and 258 deletions
|
@ -53,4 +53,31 @@ describe "Thread.new" do
|
|||
ScratchPad.recorded.should == [:good, :in_thread]
|
||||
end
|
||||
|
||||
it "releases Mutexes held by the Thread when the Thread finishes" do
|
||||
m1 = Mutex.new
|
||||
m2 = Mutex.new
|
||||
t = Thread.new {
|
||||
m1.lock
|
||||
m1.locked?.should == true
|
||||
m2.lock
|
||||
m2.locked?.should == true
|
||||
}
|
||||
t.join
|
||||
m1.locked?.should == false
|
||||
m2.locked?.should == false
|
||||
end
|
||||
|
||||
it "releases Mutexes held by the Thread when the Thread finishes, also with Mutex#synchronize" do
|
||||
m = Mutex.new
|
||||
t = Thread.new {
|
||||
m.synchronize {
|
||||
m.unlock
|
||||
m.lock
|
||||
}
|
||||
m.lock
|
||||
m.locked?.should == true
|
||||
}
|
||||
t.join
|
||||
m.locked?.should == false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue