Class that implements a wrapper for a pthread thread. More...
#include <SPL/Runtime/Utility/Thread.h>
List of all members.
Public Member Functions
|
| |
Thread () |
| int |
create (pthread_attr_t *attr=NULL, bool detached=false, void *args=NULL, bool waitStart=false, size_t stackSize=0, pthread_t *id=NULL) |
| int |
join (void *status=NULL) |
| void |
detach () |
| void |
kill (int sig=9) |
| void |
cancel () |
| void |
enableCancel (int type) |
| void |
disableCancel () |
| |
Turn off cancel.
|
| virtual void * |
run (void *args)=0 |
| virtual pthread_t |
getPThreadId () const |
Detailed Description
Class that implements a wrapper for a pthread thread.
Constructor & Destructor Documentation
Member Function Documentation
| int SPL::Thread::create |
( |
pthread_attr_t * |
attr = NULL, |
|
|
bool |
detached = false, |
|
|
void * |
args = NULL, |
|
|
bool |
waitStart = false, |
|
|
size_t |
stackSize = 0, |
|
|
pthread_t * |
id = NULL |
|
) |
|
|
|
inline |
Create a thread
- Parameters:
-
| attr |
the attributes used by pthread_create |
| detached |
create thread in detached state |
| args |
the arguments passed to the thread |
| waitStart |
wait until the thread has started |
| stackSize |
thread stack size (uses pthread default if 0) |
| id |
thread id representing this tread |
- Returns:
- return value from the
pthread_create call
| int SPL::Thread::join |
( |
void * |
status = NULL |
) |
|
|
inline |
Join a thread
- Parameters:
-
| status |
returns the value returned by a thread once it finishes |
| void SPL::Thread::detach |
( |
|
) |
|
|
inline |
| void SPL::Thread::kill |
( |
int |
sig = 9 |
) |
|
|
inline |
Send a signal to a thread
- Parameters:
-
| sig |
signal to send (see kill(1) for the possible signal values) |
| void SPL::Thread::cancel |
( |
|
) |
|
|
inline |
| void SPL::Thread::enableCancel |
( |
int |
type |
) |
|
|
inline |
Turn on cancel
- Parameters:
-
| void SPL::Thread::disableCancel |
( |
|
) |
|
|
inline |
| virtual void* SPL::Thread::run |
( |
void * |
args |
) |
|
|
pure virtual |
Execute the task a thread is supposed to do. This method is customized by someone writing the code that is supposed to be executed as a thread
- Parameters:
-
| args |
the arguments received by a thread |
| virtual pthread_t SPL::Thread::getPThreadId |
( |
|
) |
const |
|
inlinevirtual |
Obtain the thread id
- Returns:
- the thread id for the thread
The documentation for this class was generated from the following file: