Tanl Linguistic Pipeline |
A class to start and manage a thread of execution. More...
#include <Thread.h>
Public Types | |
enum | State { Created, Running, Terminated, Detached, Destroying } |
Public Member Functions | |
Thread (char const *name="") | |
Construct a user Thread. | |
Thread (Runnable *target, char const *name="") | |
Construct a user Thread for running. | |
Thread (ThreadGroup *group, Runnable *target=0, char const *name="") | |
Construct a user Thread within ThreadGroup. | |
virtual void | Join (int millis=-1, int nanos=0) |
Waits at most. | |
std::string | Name () |
virtual void | Name (std::string str) |
virtual int | Priority () |
Returns this thread's priority. | |
virtual void | Priority (int newPriority) |
Changes the priority of this thread. | |
ThreadGroup * | Group () |
bool | IsAlive () |
virtual void | Start () |
Causes this thread to begin execution, calling the Run() method of this thread's Runnable target. | |
virtual void | Run () |
When the Start() method is invoked, if this thread was constructed using a separate Runnable object, then that Runnable object's Run() method is called; otherwise this method gets called. | |
int | ActiveCount () |
Static Public Member Functions | |
static void | Yield () |
Causes the currently executing thread object to temporarily pause and allow other threads to execute. | |
static void | Sleep (int ms, int ns=0) |
Causes the currently executing thread to sleep (cease execution) for. | |
static Thread * | CurrentThread () |
A class to start and manage a thread of execution.
Threads have priorities: threads with higher priority are executed in preference to threads with lower priority.
There are two ways to create a new thread of execution. One is to declare a class to be a subclass of Thread. This subclass should implement the Run() method of interface Runnable. An instance of the subclass can then be allocated and started.
The other way to create a thread is to declare a class that implements the Runnable interface. That class then implements the Run() method. An instance of the class can then be allocated, passed as an argument when creating Thread, and started.
A Thread after creation does not run until method Start() is called.
IXE::Thread::Thread | ( | Runnable * | target, | |
char const * | name = "" | |||
) |
Construct a user Thread for running.
target |
IXE::Thread::Thread | ( | ThreadGroup * | group, | |
Runnable * | target = 0 , |
|||
char const * | name = "" | |||
) |
Construct a user Thread within ThreadGroup.
group | for running | |
target |
int IXE::Thread::ActiveCount | ( | ) |
void IXE::Thread::Join | ( | int | millis = -1 , |
|
int | nanos = 0 | |||
) | [virtual] |
Waits at most.
millis | milliseconds plus | |
nanos | nanoseconds for this thread to die. Without parameters, waits indefinitely for this thread to die. |
void IXE::Thread::Sleep | ( | int | ms, | |
int | ns = 0 | |||
) | [static] |
Causes the currently executing thread to sleep (cease execution) for.
ms | number of milliseconds plus | |
ns | number of nanoseconds. |
Referenced by Yield().