PhoenixThread  1.0.0
Tools to ease parallel programming in C++
Loading...
Searching...
No Matches
DetachPool_impl.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __DETACHPOOL_IMPL_H__
8#define __DETACHPOOL_IMPL_H__
9
10#include "DetachPool.h"
11
13
19template<typename _Callable, typename... _Args>
20void DetachPool::addThread(const std::string & description, _Callable&& __f, _Args&&... __args){
22 info.description = description;
24 p_mtx.lock();
25 p_listThreadInfo.push_back(info); //Let's add the info to the running threads
26 p_mtx.unlock();
27 std::thread thrSimpleDetach(__f, std::ref(p_listThreadInfo.back().exitStatus), __args...);
28 thrSimpleDetach.detach();
29}
30
31
32#endif
33
#define PEXIT_STATUS_NOT_FIHISHED
Definition DetachPool.h:19
void addThread(const std::string &description, _Callable &&__f, _Args &&... __args)
Add the thread into the pool.
std::mutex p_mtx
Mutex to handle exit status of detached threads.
Definition DetachPool.h:63
ListThreadDetachInfo p_listThreadInfo
List of the information related to all ongoing threads.
Definition DetachPool.h:69
Information related to the current detached thread.
Definition DetachPool.h:24
int exitStatus
Exit status of the current thread.
Definition DetachPool.h:28
std::string description
Description of the current thread.
Definition DetachPool.h:26