7#ifndef __DETACHPOOL_H__
8#define __DETACHPOOL_H__
19#define PEXIT_STATUS_NOT_FIHISHED 0
20#define PEXIT_STATUS_OK 1
21#define PEXIT_STATUS_FAIL 2
49 template<
typename _Callable,
typename... _Args>
50 void addThread(
const std::string & description, _Callable&& __f, _Args&&... __args);
std::string phoenix_statusToString(int exitStatus)
Convert the current status of a thread into a string.
std::list< ThreadDetachInfo > ListThreadDetachInfo
void phoenix_printThreadStatus(const ListThreadDetachInfo &listThreadInfo, std::ostream &out=std::cout)
Print the status of all remaning thread.
PhoenixTime p_timeLastRefresh
Time of last refresh (in micro second)
void removeFinishedThread(std::ostream &out=std::cout)
Remove all finished threads.
void initialisationDetachPool()
Initialisation function of the class DetachPool.
DetachPool & operator=(const DetachPool &other)
Definition of equal operator of DetachPool.
DetachPool()
Default constructor of DetachPool.
ListThreadDetachInfo getListThreadInfo()
Get the list of thread information.
virtual ~DetachPool()
Destructor of DetachPool.
PEllapsedTime p_refreshTime
Ellapsed time between two refresh (in micro second)
void addThread(const std::string &description, _Callable &&__f, _Args &&... __args)
Add the thread into the pool.
PEllapsedTime p_destructorWaitTime
Wait time when object is destroyed.
PEllapsedTime getDestructorWaitTime() const
Get the wait time on object destruction (in microseconds)
std::mutex p_mtx
Mutex to handle exit status of detached threads.
void setRefreshTime(PEllapsedTime refreshTime)
Set the ellasped time between two refresh in microseconds.
PEllapsedTime getRefreshTime() const
Get the ellasped time between two refresh in microseconds.
void setDestructionWaitTime(PEllapsedTime destructorWaitTime)
Set the wait time on object destruction (in microseconds)
void waitUntilAllFinish(PEllapsedTime maxWaitTime=10000000)
wait until all detached thread have fnished theirs computation
ListThreadDetachInfo p_listThreadInfo
List of the information related to all ongoing threads.
void copyDetachPool(const DetachPool &other)
Copy function of DetachPool.
void refresh()
Refresh the list of the detached threads.
std::chrono::time_point< std::chrono::steady_clock > PhoenixTime
Information related to the current detached thread.
int exitStatus
Exit status of the current thread.
std::string description
Description of the current thread.