RigsofRods
Soft-body Physics Simulation
|
/brief Handle for a task executed by ThreadPool More...
#include <ThreadPool.h>
Public Member Functions | |
void | join () const |
Block the current thread and wait for the associated task to finish. More... | |
Private Member Functions | |
Task (std::function< void()> task_func) | |
Task (Task &)=delete | |
Task & | operator= (Task &)=delete |
Private Attributes | |
bool | m_is_finished = false |
Indicates whether the task execution has finished. More... | |
std::condition_variable | m_finish_cv |
Used to signal the current thread when the task has finished. More... | |
std::mutex | m_task_mutex |
Mutex which is locked while the task is running. More... | |
const std::function< void()> | m_task_func |
Callable object which implements the task to execute. More... | |
Friends | |
class | ThreadPool |
/brief Handle for a task executed by ThreadPool
Returned by ThreadPool instance when submitting a new task to run. Provides a thin wrapper around the callable object which implements the actual task. Allows for synchronization, i.e. to wait for the associated task to finish (see join()).
Definition at line 44 of file ThreadPool.h.
|
inlineprivate |
Definition at line 71 of file ThreadPool.h.
|
privatedelete |
|
inline |
Block the current thread and wait for the associated task to finish.
Definition at line 49 of file ThreadPool.h.
|
friend |
Definition at line 46 of file ThreadPool.h.
|
mutableprivate |
Used to signal the current thread when the task has finished.
Definition at line 76 of file ThreadPool.h.
|
private |
Indicates whether the task execution has finished.
Definition at line 75 of file ThreadPool.h.
|
private |
Callable object which implements the task to execute.
Definition at line 78 of file ThreadPool.h.
|
mutableprivate |
Mutex which is locked while the task is running.
Definition at line 77 of file ThreadPool.h.