![]() |
|
PhoenixThread
1.0.0
Tools to ease parallel programming in C++
|
Pool of detached threads. More...
#include <DetachPool.h>
Public Member Functions | |
| template<typename _Callable, typename... _Args> | |
| void | addThread (const std::string &description, _Callable &&__f, _Args &&... __args) |
| Add the thread into the pool. | |
| DetachPool () | |
| Default constructor of DetachPool. | |
| DetachPool (const DetachPool &other) | |
| Copy constructor of DetachPool. | |
| PEllapsedTime | getDestructorWaitTime () const |
| Get the wait time on object destruction (in microseconds) | |
| ListThreadDetachInfo | getListThreadInfo () |
| Get the list of thread information. | |
| PEllapsedTime | getRefreshTime () const |
| Get the ellasped time between two refresh in microseconds. | |
| DetachPool & | operator= (const DetachPool &other) |
| Definition of equal operator of DetachPool. | |
| void | refresh () |
| Refresh the list of the detached threads. | |
| void | removeFinishedThread (std::ostream &out=std::cout) |
| Remove all finished threads. | |
| void | setDestructionWaitTime (PEllapsedTime destructorWaitTime) |
| Set the wait time on object destruction (in microseconds) | |
| void | setRefreshTime (PEllapsedTime refreshTime) |
| Set the ellasped time between two refresh in microseconds. | |
| void | waitUntilAllFinish (PEllapsedTime maxWaitTime=10000000) |
| wait until all detached thread have fnished theirs computation | |
| virtual | ~DetachPool () |
| Destructor of DetachPool. | |
Protected Member Functions | |
| void | copyDetachPool (const DetachPool &other) |
| Copy function of DetachPool. | |
Private Member Functions | |
| void | initialisationDetachPool () |
| Initialisation function of the class DetachPool. | |
Private Attributes | |
| PEllapsedTime | p_destructorWaitTime |
| Wait time when object is destroyed. | |
| ListThreadDetachInfo | p_listThreadInfo |
| List of the information related to all ongoing threads. | |
| std::mutex | p_mtx |
| Mutex to handle exit status of detached threads. | |
| PEllapsedTime | p_refreshTime |
| Ellapsed time between two refresh (in micro second) | |
| PhoenixTime | p_timeLastRefresh |
| Time of last refresh (in micro second) | |
Pool of detached threads.
Definition at line 34 of file DetachPool.h.
| DetachPool::DetachPool | ( | ) |
Default constructor of DetachPool.
Definition at line 35 of file DetachPool.cpp.
References initialisationDetachPool().
Referenced by copyDetachPool(), DetachPool(), and operator=().
Here is the call graph for this function:
Here is the caller graph for this function:| DetachPool::DetachPool | ( | const DetachPool & | other | ) |
Copy constructor of DetachPool.
| other | : class to copy |
Definition at line 42 of file DetachPool.cpp.
References copyDetachPool(), and DetachPool().
Here is the call graph for this function:
|
virtual |
Destructor of DetachPool.
Definition at line 47 of file DetachPool.cpp.
References p_destructorWaitTime, and waitUntilAllFinish().
Here is the call graph for this function:| void DetachPool::addThread | ( | const std::string & | description, |
| _Callable && | __f, | ||
| _Args &&... | __args ) |
Add the thread into the pool.
| description | : description of the thread (will be used in the stdout to inform when the thread is finished) |
| __f | : function to be lauched on each thread (function with prototype void f(const std::vector<std::string>& listFile, __args); ) |
| __args | : extra arguments to be passed to the function __f (optional arguments) Passed function has to have the following prototype : void f(int & exitStatus, other arguments...); |
Definition at line 20 of file DetachPool_impl.h.
References ThreadDetachInfo::description, ThreadDetachInfo::exitStatus, p_listThreadInfo, p_mtx, and PEXIT_STATUS_NOT_FIHISHED.
|
protected |
Copy function of DetachPool.
| other | : class to copy |
Definition at line 145 of file DetachPool.cpp.
References DetachPool(), p_destructorWaitTime, p_refreshTime, and p_timeLastRefresh.
Referenced by DetachPool(), and operator=().
Here is the call graph for this function:
Here is the caller graph for this function:| PEllapsedTime DetachPool::getDestructorWaitTime | ( | ) | const |
Get the wait time on object destruction (in microseconds)
Definition at line 84 of file DetachPool.cpp.
References p_destructorWaitTime.
| ListThreadDetachInfo DetachPool::getListThreadInfo | ( | ) |
Get the list of thread information.
Definition at line 91 of file DetachPool.cpp.
References p_listThreadInfo, and p_mtx.
| PEllapsedTime DetachPool::getRefreshTime | ( | ) | const |
Get the ellasped time between two refresh in microseconds.
Definition at line 70 of file DetachPool.cpp.
References p_refreshTime.
|
private |
Initialisation function of the class DetachPool.
Definition at line 152 of file DetachPool.cpp.
References p_destructorWaitTime, p_refreshTime, p_timeLastRefresh, and phoenix_thread_clock().
Referenced by DetachPool().
Here is the call graph for this function:
Here is the caller graph for this function:| DetachPool & DetachPool::operator= | ( | const DetachPool & | other | ) |
Definition of equal operator of DetachPool.
| other | : class to copy |
Definition at line 55 of file DetachPool.cpp.
References copyDetachPool(), and DetachPool().
Here is the call graph for this function:| void DetachPool::refresh | ( | ) |
Refresh the list of the detached threads.
Definition at line 119 of file DetachPool.cpp.
References p_refreshTime, p_timeLastRefresh, phoenix_ellapsedTime(), phoenix_thread_clock(), and removeFinishedThread().
Here is the call graph for this function:| void DetachPool::removeFinishedThread | ( | std::ostream & | out = std::cout | ) |
Remove all finished threads.
| [out] | out | : ostream to be used to print when a thread finishes |
Definition at line 101 of file DetachPool.cpp.
References p_listThreadInfo, p_mtx, PEXIT_STATUS_NOT_FIHISHED, and phoenix_statusToString().
Referenced by refresh(), and waitUntilAllFinish().
Here is the call graph for this function:
Here is the caller graph for this function:| void DetachPool::setDestructionWaitTime | ( | PEllapsedTime | destructorWaitTime | ) |
Set the wait time on object destruction (in microseconds)
| destructorWaitTime | : wait time on object destruction (in microseconds) |
Definition at line 77 of file DetachPool.cpp.
References p_destructorWaitTime.
| void DetachPool::setRefreshTime | ( | PEllapsedTime | refreshTime | ) |
Set the ellasped time between two refresh in microseconds.
| refreshTime | : ellasped time between two refresh in microseconds |
Definition at line 63 of file DetachPool.cpp.
References p_refreshTime.
| void DetachPool::waitUntilAllFinish | ( | PEllapsedTime | maxWaitTime = 10000000 | ) |
wait until all detached thread have fnished theirs computation
| maxWaitTime | : maximum waiting time until we kill every remaning threads (in micro second, wait 10 seconds by default) |
Definition at line 131 of file DetachPool.cpp.
References p_listThreadInfo, p_refreshTime, phoenix_ellapsedTime(), phoenix_thread_clock(), and removeFinishedThread().
Referenced by ~DetachPool().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Wait time when object is destroyed.
Definition at line 71 of file DetachPool.h.
Referenced by copyDetachPool(), getDestructorWaitTime(), initialisationDetachPool(), setDestructionWaitTime(), and ~DetachPool().
|
private |
List of the information related to all ongoing threads.
Definition at line 69 of file DetachPool.h.
Referenced by addThread(), getListThreadInfo(), removeFinishedThread(), and waitUntilAllFinish().
|
private |
Mutex to handle exit status of detached threads.
Definition at line 63 of file DetachPool.h.
Referenced by addThread(), getListThreadInfo(), and removeFinishedThread().
|
private |
Ellapsed time between two refresh (in micro second)
Definition at line 65 of file DetachPool.h.
Referenced by copyDetachPool(), getRefreshTime(), initialisationDetachPool(), refresh(), setRefreshTime(), and waitUntilAllFinish().
|
private |
Time of last refresh (in micro second)
Definition at line 67 of file DetachPool.h.
Referenced by copyDetachPool(), initialisationDetachPool(), and refresh().