MADNESS
0.10.1
|
Simplified thread wrapper to hide pthread complexity. More...
#include <thread.h>
Public Member Functions | |
Thread () | |
Default constructor. More... | |
Thread (void *(*f)(void *), void *args=nullptr) | |
Create a thread and start it running f(args) . More... | |
virtual | ~Thread ()=default |
void | start (void *(*f)(void *), void *args=nullptr) |
Start the thread by running f(args) . More... | |
Public Member Functions inherited from madness::ThreadBase | |
ThreadBase () | |
Default constructor. More... | |
virtual | ~ThreadBase () |
int | cancel () const |
Cancel this thread. More... | |
const pthread_t & | get_id () const |
Get the pthread id of this thread (if running). More... | |
int | get_pool_thread_index () const |
Get index of this thread in ThreadPool . More... | |
void | start () |
Start the thread running. More... | |
Private Member Functions | |
void | run () |
Invokes the function for this thread. More... | |
Private Attributes | |
void * | args |
The arguments passed to this thread for execution. More... | |
void *(* | f )(void *) |
The function called for executing this thread. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from madness::ThreadBase | |
static void | exit () |
A thread can call this to terminate its execution. More... | |
static int | num_hw_processors () |
Get number of actual hardware processors. More... | |
static ThreadBase * | this_thread () |
Simplified thread wrapper to hide pthread complexity.
|
inline |
Default constructor.
start()
must be invoked to actually execute the thread.
|
inline |
Create a thread and start it running f(args)
.
[in] | f | The function to be called. |
[in,out] | args | The arguments to the function. |
References madness::ThreadBase::start().
|
virtualdefault |
|
inlineprivatevirtual |
|
inline |
Start the thread by running f(args)
.
[in] | f | The function to be called. |
[in,out] | args | The arguments to the function. |
References args, f, and madness::ThreadBase::start().
Referenced by madness::ThreadPool::ThreadPool().
|
private |
|
private |