From 70f08f1eed1df4579fef047d28fc3c807183fcfa Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 21 Sep 2020 09:54:08 +1200 Subject: Make `Thread#join` non-blocking. --- spec/ruby/core/thread/join_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/ruby/core') diff --git a/spec/ruby/core/thread/join_spec.rb b/spec/ruby/core/thread/join_spec.rb index f3c5cdc1ed..6477e17b6e 100644 --- a/spec/ruby/core/thread/join_spec.rb +++ b/spec/ruby/core/thread/join_spec.rb @@ -19,8 +19,13 @@ describe "Thread#join" do t.join(0).should equal(t) t.join(0.0).should equal(t) t.join(nil).should equal(t) + end + + it "raises TypeError if the argument is not a valid timeout" do + t = Thread.new {sleep} -> { t.join(:foo) }.should raise_error TypeError -> { t.join("bar") }.should raise_error TypeError + t.kill end it "returns nil if it is not finished when given a timeout" do -- cgit v1.2.3