15 else if(exitStatus ==
PEXIT_STATUS_OK){
return "\033[32mSUCCESS\033[0m";}
17 return "\033[31mFAIL\033[0m";
26 out <<
"ListThreadDetachInfo : number of remaning threads : " << listThreadInfo.size() << std::endl;
28 for(ListThreadDetachInfo::const_iterator it(listThreadInfo.begin()); it != listThreadInfo.end(); ++it){
29 out <<
"\tthread("<<i<<
") '"<<it->description<<
"' has status " <<
phoenix_statusToString(it->exitStatus) << std::endl;
107 if(it->description !=
""){
108 out <<
"DetachPool : thread '"<<it->description<<
"' finished with status " <<
phoenix_statusToString(it->exitStatus) << std::endl;
std::string phoenix_statusToString(int exitStatus)
Convert the current status of a thread into a string.
void phoenix_printThreadStatus(const ListThreadDetachInfo &listThreadInfo, std::ostream &out)
Print the status of all remaning thread.
std::string phoenix_statusToString(int exitStatus)
Convert the current status of a thread into a string.
std::list< ThreadDetachInfo > ListThreadDetachInfo
#define PEXIT_STATUS_NOT_FIHISHED
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)
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.
PhoenixTime phoenix_thread_clock()
Get the current time.
std::chrono::time_point< std::chrono::steady_clock > PhoenixTime
PEllapsedTime phoenix_ellapsedTime(PhoenixTime referenceTime)
Compute an ellapsed time in the given unit.