PhoenixThread  1.0.0
Tools to ease parallel programming in C++
Loading...
Searching...
No Matches
DetachPool.h File Reference
#include <unistd.h>
#include <thread>
#include <list>
#include <mutex>
#include <string>
#include <iostream>
#include "phoenix_thread_clock.h"
#include "DetachPool_impl.h"
+ Include dependency graph for DetachPool.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  DetachPool
 Pool of detached threads. More...
 
struct  ThreadDetachInfo
 Information related to the current detached thread. More...
 

Macros

#define PEXIT_STATUS_FAIL   2
 
#define PEXIT_STATUS_NOT_FIHISHED   0
 
#define PEXIT_STATUS_OK   1
 

Typedefs

typedef std::list< ThreadDetachInfoListThreadDetachInfo
 

Functions

void phoenix_printThreadStatus (const ListThreadDetachInfo &listThreadInfo, std::ostream &out=std::cout)
 Print the status of all remaning thread.
 
std::string phoenix_statusToString (int exitStatus)
 Convert the current status of a thread into a string.
 

Macro Definition Documentation

◆ PEXIT_STATUS_FAIL

#define PEXIT_STATUS_FAIL   2

Definition at line 21 of file DetachPool.h.

◆ PEXIT_STATUS_NOT_FIHISHED

#define PEXIT_STATUS_NOT_FIHISHED   0

◆ PEXIT_STATUS_OK

#define PEXIT_STATUS_OK   1

Definition at line 20 of file DetachPool.h.

Referenced by phoenix_statusToString().

Typedef Documentation

◆ ListThreadDetachInfo

Definition at line 31 of file DetachPool.h.

Function Documentation

◆ phoenix_printThreadStatus()

void phoenix_printThreadStatus ( const ListThreadDetachInfo & listThreadInfo,
std::ostream & out )

Print the status of all remaning thread.

Parameters
listThreadInfo: list of thread information to be printed
out: ostream to be used to print information

Definition at line 25 of file DetachPool.cpp.

25 {
26 out << "ListThreadDetachInfo : number of remaning threads : " << listThreadInfo.size() << std::endl;
27 size_t i(0lu);
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;
30 ++i;
31 }
32}
std::string phoenix_statusToString(int exitStatus)
Convert the current status of a thread into a string.

References phoenix_statusToString().

+ Here is the call graph for this function:

◆ phoenix_statusToString()

std::string phoenix_statusToString ( int exitStatus)

Convert the current status of a thread into a string.

Parameters
exitStatus: status of the thread
Returns
corresponding string

Definition at line 13 of file DetachPool.cpp.

13 {
14 if(exitStatus == PEXIT_STATUS_NOT_FIHISHED){return "\033[33mStill Running\033[0m";}
15 else if(exitStatus == PEXIT_STATUS_OK){return "\033[32mSUCCESS\033[0m";}
16 else{
17 return "\033[31mFAIL\033[0m";
18 }
19}
#define PEXIT_STATUS_NOT_FIHISHED
Definition DetachPool.h:19
#define PEXIT_STATUS_OK
Definition DetachPool.h:20

References PEXIT_STATUS_NOT_FIHISHED, and PEXIT_STATUS_OK.

Referenced by phoenix_printThreadStatus(), and DetachPool::removeFinishedThread().

+ Here is the caller graph for this function: