Skip to content

Commit c7954ab

Browse files
committed
Add a spec to clarify that Thread#value waits for the Thread to finish
1 parent 802513d commit c7954ab

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/ruby/core/thread/value_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,14 @@
1818
t = Thread.new { Thread.current.exit }
1919
t.value.should == nil
2020
end
21+
22+
it "returns when the thread finished" do
23+
q = Queue.new
24+
t = Thread.new {
25+
q.pop
26+
}
27+
-> { t.value }.should block_caller
28+
q.push :result
29+
t.value.should == :result
30+
end
2131
end

0 commit comments

Comments
 (0)