Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
[TRIVIAL] the thread becomes dead after we get the value. also we can pass a timeout value to Thread#join and try to join afterwards
t = Thread.new { sleep 5; puts 1 }
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
t.join(1)
puts "status: #{t.status} on #{t.inspect}"
__END__
status: sleep on #<Thread:0x1d0ae48 sleep>
status: sleep on #<Thread:0x1d0ae48 sleep>
status: sleep on #<Thread:0x1d0ae48 sleep>
status: sleep on #<Thread:0x1d0ae48 sleep>
status: sleep on #<Thread:0x1d0ae48 sleep>
1
status: false on #<Thread:0x1d0ae48 dead>
status: false on #<Thread:0x1d0ae48 dead>
status: false on #<Thread:0x1d0ae48 dead>
status: false on #<Thread:0x1d0ae48 dead>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.