libperun

Class std.mt.Thread

Synopsis

public abstract class Thread

Class representing threads.

To create a thread, you must derive from this class in order to implement the thread. The basic process is as follows:

(1) Create an instance of a subclass of Thread. (2) Call the run() method. This returns immediately, and lets the thread run. (3) In the new thread, the begin() method is called, which you override to make it implement the actions you want to perform in the new thread. (4) At some point, the creating threads calls the wait() method to terminate the thread.

Fields

Constructors

Methods

protected abstract void begin();

This method is the first to be called inside the new thread when it is ran. Override it to perform the actions you need.

public final void run();

Run the thread. This function will return immediately, and in the new thread, begin() will be called.

public final void wait();

Wait for the thread to terminate.

public final void detach();

Detach the thread.