This class watches for termination of multiple threads. Basic functionality (wait until specified threads have terminated) can be accessed through the class method ::all_waits. Finer control can be gained using instance methods.
Example:
ThreadsWait.all_wait(thr1, thr2, ...) do |t|
STDERR.puts "Thread #{t} has terminated."
end
th = ThreadsWait.new(thread1,...)
th.next_wait # next one to be done
RCS_ID | = | '-$Id: thwait.rb,v 1.3 1998/06/26 03:19:34 keiju Exp keiju $-' |
[R] | threads | Returns the array of threads that have not terminated yet. |
Waits until all specified threads have terminated. If a block is provided, it is executed for each thread as they terminate.
Creates a ThreadsWait object, specifying the threads to wait on. Non-blocking.
Waits until all of the specified threads are terminated. If a block is supplied for the method, it is executed for each thread termination.
Raises exceptions in the same manner as next_wait
.
Returns true
if there are no threads in the pool still
running.
Returns true
if any thread has terminated and is ready to be
collected.
Waits for specified threads to terminate, and returns when one of the threads terminated.
Specifies the threads that this object will wait for, but does not actually wait.
Waits until any of the specified threads has terminated, and returns the one that does.
If there is no thread to wait, raises ErrNoWaitingThread
. If
nonblock
is true, and there is no terminated thread, raises
ErrNoFinishedThread
.