isAlive() -
checks to see if each of the thread objects are still "active"
and potentially available for performing tasks.F for each thread referenced if it has
been started and has exited (normally or abnormally)
or has been cancelled by another thread (even if it is not yet dead),
and T if the thread is still executing,
even if it has no tasks to perform but is accepting tasks.
NULL is returned if no such
thread (or
threadGroup) exists.
isBlocked
tests whether each of the thread objects are blocked
waiting for a lock.
isCancelled() -
tests whether each of the thread objects are considered cancelled (not simply
in cancel pending mode).
Returns T if the thread is in cancelled mode
(not just a cancel request pending) and F otherwise.
NULL is returned if the thread doesn't exist.
isIdle() -
determines whether the task queues are emptry but active
for each of the thread objects.
Returns
T for each thread that has an empty task queue and
is not evaluating a task and F for threads
that doing something. NULL is returned if the
thread doesn't exist.
isSuspended() -
tests each thread determining if it is in suspended mode.
Returns T for each thread that is currently
suspended and F for threads that are still alive.
NULL is returned if the thread doesn't exist.
isFinished() -
tests each thread to determine if it is considered terminated.
This is the opposite of isAlive(), I think.
Returns T for each thread that has completed the
tasks supplied and F if it is still executing.
NULL is returned if the thread doesn't exist.
valueOf() -
returns the exit value for each of supplied thread objects.
threadOf() -
for each object supplied, the associated thread is returned.
This is most useful for threadLock
objects so as to be able to determine which thread holds the lock
at the time of evaluation of this expression.
dbOf() - returns the database or frame
into which the toplevel assignments will be comitted
for each of the supplied threads.
searchPathOf() -
returns the search path as a vector of databases and frames
for each of the supplied threads.
F is one of the functions above
Could operate on threadGroup objects individually.
# exit if the standard reader is dead
if(!isAlive(main.stdin.thread))
q()
|
|---|
if(threadOf(lock)!= self())
getLock(lock)
|
if(isAlive(tA))
suspend(tA)
|
# find an idle thread and send it the next task.
group = threadGroup()
i = min((1:length(group))[isIdle(group)])
sendTask(Quote(next.expression), group[i])
|