class VThread

Class VThread Defines a simple thread class which provides means of controlling a separate thread of control in which the scheduling mechanism and priority may be specified

Public Methods

void exit()
Exit the current thread of control associated with the VThread
const vthread_attr_t* getAttributes()
Return ptr to the os specific attributes of the VThread
const vthread_t* getId()
Return the unique Id of the VThread
int getPriority()
Returns the priority of the thread
int join( void **status = 0 )
Wait for thread to exit
static const vthread_t selfId()
Return the VThread ID of the current process
int setPriority( int priority ) throw(VThreadExceptionInvalidPriority&)
Set the priority of the thread
int spawn( void *(*startFunc)(void *), void *startArgs = 0, unsigned long flags = 0, unsigned long priority = VTHREAD_PRIORITY_DEFAULT, int stack_size = VTHREAD_STACK_SIZE_DEFAULT ) throw(VThreadException&)
Creates a new thread of control, with the specified attributes, running startFunc with startArgs
VThread( )
Create an empty VThread object Note, this does NOT start a new thread of control associated with the VThread
virtual ~VThread( )
Delete a VThread object Note, this does not stop the thread of control associated with the VThread

Documentation

Class VThread Defines a simple thread class which provides means of controlling a separate thread of control in which the scheduling mechanism and priority may be specified. Other potentially operating system dependent capabilites are provided in generic fashion as deemed necessary and useful. Each instance of the class supports one thread of execution. Creating multiple threads requires creating multiple VThread objects. The following exceptions may be thrown by methods of this class: VExceptionMemory(), VThreadExceptionInvalidAttributes(), VThreadExceptionInvalidPriority()
VThread( )
Create an empty VThread object Note, this does NOT start a new thread of control associated with the VThread

virtual ~VThread( )
Delete a VThread object Note, this does not stop the thread of control associated with the VThread

int spawn( void *(*startFunc)(void *), void *startArgs = 0, unsigned long flags = 0, unsigned long priority = VTHREAD_PRIORITY_DEFAULT, int stack_size = VTHREAD_STACK_SIZE_DEFAULT ) throw(VThreadException&)
Creates a new thread of control, with the specified attributes, running startFunc with startArgs. The flags are a bitwise-OR of the following: VTHREAD_SCHED_FIFO, VTHREAD_SCHED_RR, VTHREAD_SCHED_DEFAULT, ( rest not supported yet) VTHREAD_CANCEL_DISABLE, VTHREAD_CANCEL_ENABLE, VTHREAD_CANCEL_DEFERRED, VTHREAD_CANCEL_ASYNCHRONOUS, VTHREAD_BOUND, VTHREAD_NEW_LWP, VTHREAD_DETACHED, VTHREAD_SUSPENDED, VTHREAD_DAEMON, VTHREAD_JOINABLE, By default, or if priority is set to VTHREAD_PRIORITY_DEFAULT, an "appropriate" priority value for the given scheduling policy (specified in flags, e.g., VTHREAD_SCHED_DEFAULT) is used. This value is calculated dynamically, and is the median value between the minimum and maximum priority values for the given policy. If an explicit value is given, it is used. Note that actual priority values are EXTREMEMLY implementation-dependent, and are probably best avoided. The following exceptions may be thrown by this method: VThreadExceptionInvalidAttributes(), VThreadExceptionInvalidPriority() Returns 0, if successful, or a negative error code.

int join( void **status = 0 )
Wait for thread to exit. Returns 0 if successful, or a negative error code.

int getPriority()
Returns the priority of the thread

int setPriority( int priority ) throw(VThreadExceptionInvalidPriority&)
Set the priority of the thread. Returns 0 if successful, or a negative error code. The following exceptions may be thrown by this method: VThreadExceptionInvalidPriority()

const vthread_t* getId()
Return the unique Id of the VThread

const vthread_attr_t* getAttributes()
Return ptr to the os specific attributes of the VThread

void exit()
Exit the current thread of control associated with the VThread

static const vthread_t selfId()
Return the VThread ID of the current process


This class has no child classes.

alphabetic index hierarchy of classes


generated by doc++