PhoenixThread
1.2.3
Tools to ease parallel programming in C++
Toggle main menu visibility
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
19
template
<
typename
_Callable,
typename
... _Args>
20
void
DetachPool::addThread
(
const
std::string & description, _Callable&& __f, _Args&&... __args){
21
ThreadDetachInfo
info;
22
info.
description
= description;
23
info.
exitStatus
=
PEXIT_STATUS_NOT_FIHISHED
;
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
DetachPool.h
PEXIT_STATUS_NOT_FIHISHED
#define PEXIT_STATUS_NOT_FIHISHED
Definition
DetachPool.h:19
DetachPool::addThread
void addThread(const std::string &description, _Callable &&__f, _Args &&... __args)
Add the thread into the pool.
Definition
DetachPool_impl.h:20
DetachPool::p_mtx
std::mutex p_mtx
Mutex to handle exit status of detached threads.
Definition
DetachPool.h:63
DetachPool::p_listThreadInfo
ListThreadDetachInfo p_listThreadInfo
List of the information related to all ongoing threads.
Definition
DetachPool.h:69
ThreadDetachInfo
Information related to the current detached thread.
Definition
DetachPool.h:24
ThreadDetachInfo::exitStatus
int exitStatus
Exit status of the current thread.
Definition
DetachPool.h:28
ThreadDetachInfo::description
std::string description
Description of the current thread.
Definition
DetachPool.h:26
src
DetachPool_impl.h
Generated by
1.17.0