Evo C++ Library v0.5.1
|
#include <evo/thread.h>
Manages a single thread of execution.
-pthread
-lpthread
C/C++ -> Code Generation -> Runtime Library
Classes | |
struct | Init |
Initialization structure for starting a function-based thread. More... | |
Public Types | |
typedef std::function< void(void *)> | Func |
Thread function type – with C++11 supports lambda/functor, otherwise just function pointer More... | |
Public Member Functions | |
Thread () | |
Constructor. More... | |
Thread (Func func, void *arg=NULL) | |
Constructor for function-based thread. More... | |
Thread (const Init &init) | |
Constructor for function-based thread. More... | |
virtual | ~Thread () |
Destructor. More... | |
bool | thread_active () const |
Get whether thread is active (running). More... | |
virtual bool | thread_detach () |
Detach thread to run in background. More... | |
SysThread::Handle | thread_handle () const |
Get platform-specific thread handle. More... | |
bool | thread_join () |
Join thread by waiting for thread to stop. More... | |
bool | thread_start () |
Start thread. More... | |
Static Public Member Functions | |
static ulong | id () |
Get current thread ID from system. More... | |
static void | yield () |
Yield control to another thread or process. More... | |
Public Attributes | |
Init | thread_init |
Thread function pointer More... | |
Protected Attributes | |
bool | thread_active_ |
SysThread | thread_impl_ |
typedef std::function<void (void*)> Func |
Thread function type – with C++11 supports lambda/functor, otherwise just function pointer
|
inline |
Constructor.
Constructor for function-based thread.
func | Thread function pointer |
arg | Argument to pass to thread function |
Constructor for function-based thread.
init | Initialization data for thread |
|
inlinevirtual |
Destructor.
|
inlinestatic |
Get current thread ID from system.
|
inline |
Get whether thread is active (running).
|
inlinevirtual |
Detach thread to run in background.
|
inline |
Get platform-specific thread handle.
|
inline |
Join thread by waiting for thread to stop.
|
inline |
Start thread.
|
inlinestatic |
Yield control to another thread or process.
|
protected |
|
protected |
Init thread_init |
Thread function pointer