Ruby multiple background threads
I need to start multiple background threads in a thread pool with a timeout. The diagram looks something like this:
#!/usr/bin/env ruby
require 'thread'
def foo(&block)
bar(block)
end
def bar(block)
Thread.abort_on_exception=true
@main = Thread.new { block.call }
end
foo {
sleep 1
puts 'test'
}
Why, if I run, I don't get the exit? (and no waiting waiting?)
+2
a source to share
2 answers