I need to run multiple background threads in a thread pool with timeout. The scheme is something like:
#!/usr/bin/env ruby require \'thread\' def foo(&
The program ends when the main thread ends. You have to wait on the thread created by bar using join:
bar
join
foo { sleep 1 puts 'test' }.join
Try the work_queue gem http://rubygems.org/gems/work_queue/