ONPOSIX
2.0
|
Class for simple thread invocation. More...
#include <SimpleThread.hpp>
Public Member Functions | |
SimpleThread (void(*handler)(void *p), void *arg) | |
virtual | ~SimpleThread () |
void | run () |
Method run on the new thread. | |
Public Member Functions inherited from AbstractThread | |
AbstractThread () | |
Constructor. Initialize the class attributes. | |
virtual | ~AbstractThread () |
Destructor. | |
bool | start () |
Starts execution of the thread by calling run(). | |
bool | stop () |
Stops the running thread. | |
bool | waitForTermination () |
Blocks the calling thread until the thread is finished. | |
bool | sendSignal (int sig) |
Sends a signal to the thread. | |
bool | setSchedParam (int policy, int priority) |
Set scheduling policy and priority. | |
bool | getSchedParam (int *policy, int *priority) |
Get current scheduling policy and priority. |
Private Attributes | |
void(* | handler_ )(void *p) |
void * | arg_ |
Additional Inherited Members | |
Static Public Member Functions inherited from AbstractThread | |
static bool | blockSignal (int sig) |
Masks a specific signal on this thread. | |
static bool | unblockSignal (int sig) |
Unmasks a signal previously masked. | |
static bool | setSignalHandler (int sig, void(*handler)(int)) |
Set a handler for a specific signal. | |
Static Protected Member Functions inherited from AbstractThread | |
static void | checkTermination () |
Function to know if the thread has finished computation. | |
Protected Attributes inherited from AbstractThread | |
pthread_t | handle_ |
Class for simple thread invocation.
This class is useful for creating threads that do not return any value. For more complex cases (e.g., return value), create your own thread by inheriting from class AbstractThread.
Example of usage:
Definition at line 55 of file SimpleThread.hpp.
|
inline |
Definition at line 62 of file SimpleThread.hpp.
|
inlinevirtual |
Definition at line 65 of file SimpleThread.hpp.
|
inlinevirtual |
Method run on the new thread.
This method is run on the new thread once start() is invoked.
Implements AbstractThread.
Definition at line 73 of file SimpleThread.hpp.
|
private |
Definition at line 58 of file SimpleThread.hpp.
|
private |
Definition at line 57 of file SimpleThread.hpp.