SUNphi  1.0
Thread.hpp
Go to the documentation of this file.
1 #ifndef _THREAD_HPP
2 #define _THREAD_HPP
3 
4 /// \file Thread.hpp
5 ///
6 /// \brief Basic functionalities of threads
7 
8 #ifdef HAVE_CONFIG_H
9  #include "config.hpp"
10 #endif
11 
12 #include <pthread.h>
13 #include <thread>
14 
15 /// States that we want to debug threads
16 [[ maybe_unused ]]
17 constexpr bool DEBUG_THREADS=
18  true;
19 
20 namespace SUNphi
21 {
22  /// Thread id of master thread
23  [[ maybe_unused ]]
24  constexpr int masterThreadId=
25  0;
26 
27  /// Makes all thread print for current scope
28 #ifdef USE_THREADS
29  #define ALLOWS_ALL_THREADS_TO_PRINT_FOR_THIS_SCOPE(LOGGER)
30  SET_FOR_CURRENT_SCOPE(LOGGER_ALL_THREADS_PRINT,LOGGER.onlyMasterThreadPrint,false)
31 #else
32  #define ALLOWS_ALL_THREADS_TO_PRINT_FOR_THIS_SCOPE(LOGGER)
33 #endif
34 }
35 
36 #endif
constexpr bool DEBUG_THREADS
States that we want to debug threads.
Definition: Thread.hpp:17
constexpr int masterThreadId
Thread id of master thread.
Definition: Thread.hpp:24
#define SET_FOR_CURRENT_SCOPE(NAME, VAR,...)
Set for current scope.
Definition: File.hpp:21