|
#include <CThread.h>

Public Member Functions | |
| CThread (std::string name) | |
| Constructor. | |
| virtual | ~CThread () |
| Destructor. | |
| void | run () |
| Starts the already created thread. | |
| virtual void | threadFunction ()=0 |
| The thread function. Should be overwritten by the derived class. | |
| void | terminate () |
| Requests to terminate the thread. | |
| bool | terminated () const |
| Returns true if the thread is terminated. | |
| bool | running () const |
| Returns true if the thread is running. | |
| uint64_t | id () const |
| Returns this thread OS id. | |
| const std::string & | name () const |
| Returns the name of the thread. | |
Static Public Member Functions | |
| static uint64_t | contextThreadId () |
| Returns context thread OS id. | |
| static void | msleep (int msec) |
| Pauses the thread. | |
Protected Member Functions | |
| void | createThread () |
| Creates a thread. | |
| void | joinThread () |
| Waits until thread joins. | |
| void | destroyThread () |
| Destroys the thread. | |
| void | runThread () |
| Executes the thread function. | |
Static Protected Member Functions | |
| static void * | threadStart (void *p) |
| Internally starts a new thread. | |
Protected Attributes | |
| bool | m_terminated |
| Flag: is the thread terminated? | |
| std::string | m_name |
| Thread name. | |
| uint64_t | m_id |
| pthread_t | m_thread |
| Thread handle. | |
Should be used for deriving a user thread by overwriting threadFunction().
| sptk::CThread::CThread | ( | std::string | name | ) |
Constructor.
| name | CString, name of the thread for future references. |
| static void sptk::CThread::msleep | ( | int | msec | ) | [static] |
Pauses the thread.
| msec | int, pause time in milliseconds |