Name
ThreadsWait — Thread termination watcher class
Synopsis
This class watches termination of multiple threads.
Required Library
require ‘thwait’
Class Methods
ThreadsWait::all_waits(
th,...
)
ThreadsWait::all_waits(
th...
) {
...
}
Waits until all specified threads are terminated. If a block is supplied for the method, evaluates it for each thread termination.
ThreadsWait.new(
th...
)
Creates a
ThreadsWait
object, specifying threads to wait.
Instance Methods
th
.threads
Lists threads to be synchronized
th
.empty?
Returns
true
if there is no thread to be synchronized.th
.finished?
Returns
true
if there is any terminated thread.th
.join(
th...
)
Waits for specified threads.
th
.join_nowait(
th...
)
Specifies threads to wait; non-blocking.
th
.next_wait
Waits until any specified thread is terminated.
th
.all_waits
th
.all_waits{
...
}
Waits until all specified threads are terminated. If a block is supplied for the method, evaluates it for each thread termination.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.