generic pthread wrapper class
More...
#include <ddcThread.h>
generic pthread wrapper class
◆ ddcThread()
◆ ~ddcThread()
ddcThread::~ddcThread |
( |
| ) |
|
|
virtual |
Default destructor
- detaches thread via pthread_detach() if running and not already detached
- if thread is flagged as running, it will be cancelled via pthread_cancel()
◆ self()
pthread_t ddcThread::self |
( |
| ) |
const |
|
inline |
◆ toString()
std::string ddcThread::toString |
( |
void |
| ) |
const |
|
virtual |
get string representation of the current thread
◆ attr()
pthread_attr_t* ddcThread::attr |
( |
| ) |
const |
|
inline |
get current thread attributes (for use by child classes)
◆ running()
int ddcThread::running |
( |
| ) |
const |
|
inline |
get value of m_running flag
◆ detached()
int ddcThread::detached |
( |
| ) |
const |
|
inline |
get value of m_detached flag
◆ init()
virtual void ddcThread::init |
( |
| ) |
|
|
inlinevirtual |
called by default start() to initalize m_attr.
◆ start()
◆ join()
attempt to pthread_join() the current thread iff it is running.
- blocks until thread has completed
- if successful, thread is marked as detached
- Returns
- ENOTSUP if thread is not running, otherwise as for pthread_join()
◆ detach()
int ddcThread::detach |
( |
bool |
force = false | ) |
|
|
virtual |
attempt to pthread_detach() the current thread iff it is running and not detached.
- call if you don't want to wait for the thread to complete.
- on success, thread is flagged as detached.
- Parameters
-
force | if true, thread will be flagged as not running. in this case, the underlying pthread may outlive the ddcThread wrapper object, and its run() method should terminate by calling pthread_exit(). |
- Returns
- ENOTSUP if thread is not running, otherwise as for pthread_detach()
◆ run()
virtual void* ddcThread::run |
( |
| ) |
|
|
pure virtual |
code to execute inside the newly created thread after start()
- derived clases must override this method
- Returns
- void* as expected by pthread_create routines
Implemented in CDDCServerThread.
◆ m_tid
pthread_t ddcThread::m_tid |
|
protected |
◆ m_attr
pthread_attr_t* ddcThread::m_attr |
|
protected |
underlying thread attributes (NULL by default)
◆ m_running
is this thread is currently running?
◆ m_detached
int ddcThread::m_detached |
|
protected |
is this thread currently detached?
The documentation for this class was generated from the following files: