Thread
class provides an abstraction to the multi-threading
facilities provided by the underlying operating system.
A new thread is started by the performInThread with
method provided
by the instance All
. The value returned by that method is the
Thread
object of the newly created thread.
Every thread has an id. The id of the current thread is available
from the Thread
class as current_id
. The main thread (which every
program has, even when running single-threaded) has id 0. Due to the
differences in target implementations, exiting the main thread, by
invoking that Thread
's exit
method, is not guaranteed not to exit
the program.
Multi-threading need not be available on all TOM targets. The
functioning
method returns FALSE
on those targets on which
multi-threading is not available. However, a TOM programmer can
assume multi-threading to always be available.
static MutableEqSet threads;
local static public instance (id) current;
local static public int current_id;
boolean functioning;
TRUE
iff we can run multiple threads on this target.
Set threads;
public int thread_id;
void exit int rc pre self == [#current];
protected id (self) init int th_id;