Tanl Linguistic Pipeline

IXE::Thread Class Reference

A class to start and manage a thread of execution. More...

#include <Thread.h>

Inheritance diagram for IXE::Thread:
IXE::Runnable IXE::Lock

List of all members.

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.
ThreadGroupGroup ()
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 ThreadCurrentThread ()

Detailed Description

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.


Constructor & Destructor Documentation

IXE::Thread::Thread ( Runnable target,
char const *  name = "" 
)

Construct a user Thread for running.

Parameters:
target 
IXE::Thread::Thread ( ThreadGroup group,
Runnable target = 0,
char const *  name = "" 
)

Construct a user Thread within ThreadGroup.

Parameters:
group for running
target 

Member Function Documentation

int IXE::Thread::ActiveCount (  ) 
Returns:
the current number of active threads in this thread's thread group
void IXE::Thread::Join ( int  millis = -1,
int  nanos = 0 
) [virtual]

Waits at most.

Parameters:
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.

Parameters:
ms number of milliseconds plus
ns number of nanoseconds.

Referenced by Yield().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
 
Copyright © 2005-2011 G. Attardi. Generated on 4 Mar 2011 by doxygen 1.6.1.