GCC Code Coverage Report


Directory: ./
File: src/DetachPool_impl.h
Date: 2025-11-27 16:39:31
Exec Total Coverage
Lines: 10 10 100.0%
Functions: 2 2 100.0%
Branches: 5 5 100.0%

Line Branch Exec Source
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
12 ///Add the thread into the pool
13 /** @param description : description of the thread (will be used in the stdout to inform when the thread is finished)
14 * @param __f : function to be lauched on each thread (function with prototype void f(const std::vector<std::string>& listFile, __args); )
15 * @param __args : extra arguments to be passed to the function __f (optional arguments)
16 * Passed function has to have the following prototype :
17 * void f(int & exitStatus, other arguments...);
18 */
19 template<typename _Callable, typename... _Args>
20 12 void DetachPool::addThread(const std::string & description, _Callable&& __f, _Args&&... __args){
21 12 ThreadDetachInfo info;
22
1/1
✓ Branch 0 (3→4) taken 12 times.
12 info.description = description;
23 12 info.exitStatus = PEXIT_STATUS_NOT_FIHISHED;
24
1/1
✓ Branch 0 (4→5) taken 12 times.
12 p_mtx.lock();
25
1/1
✓ Branch 0 (5→6) taken 12 times.
12 p_listThreadInfo.push_back(info); //Let's add the info to the running threads
26 12 p_mtx.unlock();
27
1/1
✓ Branch 0 (9→10) taken 12 times.
12 std::thread thrSimpleDetach(__f, std::ref(p_listThreadInfo.back().exitStatus), __args...);
28
1/1
✓ Branch 0 (10→11) taken 12 times.
12 thrSimpleDetach.detach();
29 12 }
30
31
32 #endif
33
34