Rudiments
Public Member Functions | Static Public Member Functions | List of all members
thread Class Reference

Public Member Functions

 thread ()
 
virtual ~thread ()
 
void setFunction (void *(*function)(void *))
 
void setArgument (void *arg)
 
bool setStackSize (size_t stacksize)
 
bool getStackSize (size_t *stacksize)
 
bool run ()
 
bool run (void *arg)
 
void exit (int32_t *status)
 
bool join (int32_t *status)
 
bool detach ()
 
bool cancel ()
 
bool raiseSignal (int32_t signum)
 

Static Public Member Functions

static bool supportsThreads ()
 

Detailed Description

The thread class provides a simple thread implementation.

Constructor & Destructor Documentation

thread::thread ( )

Creates an instance of the thread class.

virtual thread::~thread ( )
virtual

Deletes this instance of the thread class.

Member Function Documentation

bool thread::cancel ( )

Cancels execution of the thread.

bool thread::detach ( )

Detaches the thread so that it may exit without calling exit() and without another thread needing to call join(). Returns true on success and false if an error occurred.

void thread::exit ( int32_t *  status)

Causes a thread to exit with the value stored in the location pointed to by "status". If another thread is waiting on this thread using join(), then that thread's join() method will fall through.

bool thread::getStackSize ( size_t *  stacksize)

Sets "stacksize" to this thread's stack size. Returns true on success and false if an error occurred.

bool thread::join ( int32_t *  status)

Waits for the function set by setFunction() and run by run() to call exit() or return. This method should be called by a second thread. If non-NULL, "status" will be set to the exit status of the thread. Returns true on success and false if an error occurred.

bool thread::raiseSignal ( int32_t  signum)

Sends signal "signum" to the thread.

bool thread::run ( )

Starts a new thread by running whatever function was set by the setFunction() method and passing that function whatever argument was set by the setArgument() method. Returns true on success and false if an error occurred.

bool thread::run ( void *  arg)

Starts a new thread by running whatever function was set by the setFunction() method, passing that function argument "arg". Returns true on success and false if an error occurred.

void thread::setArgument ( void *  arg)

Defines the argument that will be passed to the function when run() is called.

void thread::setFunction ( void *(*)(void *)  function)

Defines the function that will be run when run() is called.

bool thread::setStackSize ( size_t  stacksize)

Sets this thread's stack size to "stacksize". Returns true on success and false if an error occurred.

static bool thread::supportsThreads ( )
static

Returns true if the platform supports threads and rudiments was built with thread support and false otherwise.