8.72. File tom/Thread

class tom.Thread

The 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.


State supers: State


static MutableEqSet threads;

The currently existing threads.

local static public instance (id) current;

The current thread.

local static public int current_id;

The id of the current thread.



Return TRUE iff we can run multiple threads on this target.


Return the currently existing threads.

instance tom.Thread


public int thread_id;

The TOM thread id of this thread.


  exit int rc
  self == [Thread current];

Exit the receiving thread, which must be the current thread.

protected id (self)
  init int th_id;

Designated initializer.