Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/global/management/include/G4Threading.hh

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /global/management/include/G4Threading.hh (Version 11.3.0) and /global/management/include/G4Threading.hh (Version 11.0.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4Threading                                     26 // G4Threading
 27 //                                                 27 //
 28 // Description:                                    28 // Description:
 29 //                                                 29 //
 30 // This unit defines types and macros used to      30 // This unit defines types and macros used to expose Geant4 threading model.
 31                                                    31 
 32 // Author: Andrea Dotti, 15 February 2013 - Fi     32 // Author: Andrea Dotti, 15 February 2013 - First Implementation
 33 // Revision: Jonathan R. Madsen, 21 February 2     33 // Revision: Jonathan R. Madsen, 21 February 2018
 34 // -------------------------------------------     34 // --------------------------------------------------------------------
 35 #ifndef G4Threading_hh                             35 #ifndef G4Threading_hh
 36 #define G4Threading_hh 1                           36 #define G4Threading_hh 1
 37                                                    37 
 38 #include "G4Types.hh"                              38 #include "G4Types.hh"
 39 #include "globals.hh"                              39 #include "globals.hh"
 40                                                    40 
 41 #include <chrono>                                  41 #include <chrono>
 42 #include <condition_variable>                      42 #include <condition_variable>
 43 #include <future>                                  43 #include <future>
 44 #include <mutex>                                   44 #include <mutex>
 45 #include <thread>                                  45 #include <thread>
 46 #include <vector>                                  46 #include <vector>
 47                                                    47 
 48 // Macro to put current thread to sleep            48 // Macro to put current thread to sleep
 49 //                                                 49 //
 50 #define G4THREADSLEEP(tick)                        50 #define G4THREADSLEEP(tick)                                                    \
 51   std::this_thread::sleep_for(std::chrono::sec     51   std::this_thread::sleep_for(std::chrono::seconds(tick))
 52                                                    52 
 53 // Will be used in the future when migrating t     53 // Will be used in the future when migrating threading to task-based style
 54 template <typename _Tp>                            54 template <typename _Tp>
 55 using G4Future = std::future<_Tp>;                 55 using G4Future = std::future<_Tp>;
 56 template <typename _Tp>                            56 template <typename _Tp>
 57 using G4SharedFuture = std::shared_future<_Tp>     57 using G4SharedFuture = std::shared_future<_Tp>;
 58 template <typename _Tp>                            58 template <typename _Tp>
 59 using G4Promise = std::promise<_Tp>;               59 using G4Promise = std::promise<_Tp>;
 60                                                    60 
 61 //          NOTE ON GEANT4 SERIAL BUILDS AND M     61 //          NOTE ON GEANT4 SERIAL BUILDS AND MUTEX/UNIQUE_LOCK
 62 //          ==================================     62 //          ==================================================
 63 //                                                 63 //
 64 // G4Mutex and G4RecursiveMutex are always C++     64 // G4Mutex and G4RecursiveMutex are always C++11 std::mutex types
 65 // however, in serial mode, using G4MUTEXLOCK      65 // however, in serial mode, using G4MUTEXLOCK and G4MUTEXUNLOCK on these
 66 // types has no effect -- i.e. the mutexes are     66 // types has no effect -- i.e. the mutexes are not actually locked or unlocked
 67 //                                                 67 //
 68 // Additionally, when a G4Mutex or G4Recursive     68 // Additionally, when a G4Mutex or G4RecursiveMutex is used with G4AutoLock
 69 // and G4RecursiveAutoLock, respectively, thes     69 // and G4RecursiveAutoLock, respectively, these classes also suppressing
 70 // the locking and unlocking of the mutex. Reg     70 // the locking and unlocking of the mutex. Regardless of the build type,
 71 // G4AutoLock and G4RecursiveAutoLock inherit      71 // G4AutoLock and G4RecursiveAutoLock inherit from std::unique_lock<std::mutex>
 72 // and std::unique_lock<std::recursive_mutex>,     72 // and std::unique_lock<std::recursive_mutex>, respectively. This means
 73 // that in situations (such as is needed by th     73 // that in situations (such as is needed by the analysis category), the
 74 // G4AutoLock and G4RecursiveAutoLock can be p     74 // G4AutoLock and G4RecursiveAutoLock can be passed to functions requesting
 75 // a std::unique_lock. Within these functions,     75 // a std::unique_lock. Within these functions, since std::unique_lock
 76 // member functions are not virtual, they will     76 // member functions are not virtual, they will not retain the dummy locking
 77 // and unlocking behavior                          77 // and unlocking behavior
 78 // --> An example of this behavior can be foun     78 // --> An example of this behavior can be found in G4AutoLock.hh
 79                                                    79 
 80 // Global mutex types                              80 // Global mutex types
 81 using G4Mutex          = std::mutex;               81 using G4Mutex          = std::mutex;
 82 using G4RecursiveMutex = std::recursive_mutex;     82 using G4RecursiveMutex = std::recursive_mutex;
 83                                                    83 
 84 // Mutex macros                                    84 // Mutex macros
 85 #define G4MUTEX_INITIALIZER                        85 #define G4MUTEX_INITIALIZER                                                    \
 86   {}                                               86   {}
 87 #define G4MUTEXINIT(mutex)                         87 #define G4MUTEXINIT(mutex)                                                     \
 88   ;                                                88   ;                                                                            \
 89   ;                                                89   ;
 90 #define G4MUTEXDESTROY(mutex)                      90 #define G4MUTEXDESTROY(mutex)                                                  \
 91   ;                                                91   ;                                                                            \
 92   ;                                                92   ;
 93                                                    93 
 94 // Static functions: get_id(), sleep_for(...),     94 // Static functions: get_id(), sleep_for(...), sleep_until(...), yield(),
 95 namespace G4ThisThread                             95 namespace G4ThisThread
 96 {                                                  96 {
 97   using namespace std::this_thread;                97   using namespace std::this_thread;
 98 }                                                  98 }
 99                                                    99 
100 // Will be used in the future when migrating t    100 // Will be used in the future when migrating threading to task-based style
101 // and are currently used in unit tests           101 // and are currently used in unit tests
102 template <typename _Tp>                           102 template <typename _Tp>
103 using G4Promise = std::promise<_Tp>;              103 using G4Promise = std::promise<_Tp>;
104 template <typename _Tp>                           104 template <typename _Tp>
105 using G4Future = std::future<_Tp>;                105 using G4Future = std::future<_Tp>;
106 template <typename _Tp>                           106 template <typename _Tp>
107 using G4SharedFuture = std::shared_future<_Tp>    107 using G4SharedFuture = std::shared_future<_Tp>;
108                                                   108 
109 // Some useful types                              109 // Some useful types
110 using G4ThreadFunReturnType = void*;              110 using G4ThreadFunReturnType = void*;
111 using G4ThreadFunArgType    = void*;              111 using G4ThreadFunArgType    = void*;
112 using thread_lock =                               112 using thread_lock =
113   G4int (*)(G4Mutex*);  // typedef G4int (*thr    113   G4int (*)(G4Mutex*);  // typedef G4int (*thread_lock)(G4Mutex*);
114 using thread_unlock =                             114 using thread_unlock =
115   G4int (*)(G4Mutex*);  // typedef G4int (*thr    115   G4int (*)(G4Mutex*);  // typedef G4int (*thread_unlock)(G4Mutex*);
116                                                   116 
117 // Helper function for getting a unique static    117 // Helper function for getting a unique static mutex for a specific
118 // class or type                                  118 // class or type
119 // Usage example:                                 119 // Usage example:
120 //   a template class "G4Cache<T>" that requir    120 //   a template class "G4Cache<T>" that required a static
121 //   mutex for specific to type T:                121 //   mutex for specific to type T:
122 //      G4AutoLock l(G4TypeMutex<G4Cache<T>>()    122 //      G4AutoLock l(G4TypeMutex<G4Cache<T>>());
123 template <typename _Tp>                           123 template <typename _Tp>
124 G4Mutex& G4TypeMutex()                         << 124 G4Mutex& G4TypeMutex(const unsigned int& _n = 0)
125 {                                                 125 {
126   static G4Mutex _mutex;                       << 126   static G4Mutex* _mutex = new G4Mutex();
127   return _mutex;                               << 127   if(_n == 0)
                                                   >> 128     return *_mutex;
                                                   >> 129 
                                                   >> 130   static std::vector<G4Mutex*> _mutexes;
                                                   >> 131   if(_n > _mutexes.size())
                                                   >> 132     _mutexes.resize(_n, nullptr);
                                                   >> 133   if(!_mutexes[_n])
                                                   >> 134     _mutexes[_n] = new G4Mutex();
                                                   >> 135   return *(_mutexes[_n - 1]);
128 }                                                 136 }
129                                                   137 
130 // Helper function for getting a unique static    138 // Helper function for getting a unique static recursive_mutex for a
131 // specific class or type                         139 // specific class or type
132 // Usage example:                                 140 // Usage example:
133 //                a template class "G4Cache<T>    141 //                a template class "G4Cache<T>" that required a static
134 //                recursive_mutex for specific    142 //                recursive_mutex for specific to type T:
135 //                        G4RecursiveAutoLock     143 //                        G4RecursiveAutoLock
136 //                        l(G4TypeRecursiveMut    144 //                        l(G4TypeRecursiveMutex<G4Cache<T>>());
137 template <typename _Tp>                           145 template <typename _Tp>
138 G4RecursiveMutex& G4TypeRecursiveMutex()       << 146 G4RecursiveMutex& G4TypeRecursiveMutex(const unsigned int& _n = 0)
139 {                                                 147 {
140   static G4RecursiveMutex _mutex;              << 148   static G4RecursiveMutex* _mutex = new G4RecursiveMutex();
141   return _mutex;                               << 149   if(_n == 0)
                                                   >> 150     return *(_mutex);
                                                   >> 151 
                                                   >> 152   static std::vector<G4RecursiveMutex*> _mutexes;
                                                   >> 153   if(_n > _mutexes.size())
                                                   >> 154     _mutexes.resize(_n, nullptr);
                                                   >> 155   if(!_mutexes[_n])
                                                   >> 156     _mutexes[_n] = new G4RecursiveMutex();
                                                   >> 157   return *(_mutexes[_n - 1]);
142 }                                                 158 }
143                                                   159 
144 #if defined(G4MULTITHREADED)                      160 #if defined(G4MULTITHREADED)
145 //==========================================      161 //==========================================
146 // G4MULTITHREADED is ON - threading enabled      162 // G4MULTITHREADED is ON - threading enabled
147 //==========================================      163 //==========================================
148                                                   164 
149 // global thread types                            165 // global thread types
150 using G4Thread       = std::thread;               166 using G4Thread       = std::thread;
151 using G4NativeThread = std::thread::native_han    167 using G4NativeThread = std::thread::native_handle_type;
152                                                   168 
153 // mutex macros                                   169 // mutex macros
154 #  define G4MUTEXLOCK(mutex)                      170 #  define G4MUTEXLOCK(mutex)                                                   \
155     {                                             171     {                                                                          \
156       (mutex)->lock();                            172       (mutex)->lock();                                                         \
157     }                                             173     }
158 #  define G4MUTEXUNLOCK(mutex)                    174 #  define G4MUTEXUNLOCK(mutex)                                                 \
159     {                                             175     {                                                                          \
160       (mutex)->unlock();                          176       (mutex)->unlock();                                                       \
161     }                                             177     }
162                                                   178 
163 // Macro to join thread                           179 // Macro to join thread
164 #  define G4THREADJOIN(worker) (worker).join()    180 #  define G4THREADJOIN(worker) (worker).join()
165                                                   181 
166 // std::thread::id does not cast to integer       182 // std::thread::id does not cast to integer
167 using G4Pid_t = std::thread::id;                  183 using G4Pid_t = std::thread::id;
168                                                   184 
169 // Instead of previous macro taking one argume    185 // Instead of previous macro taking one argument, define function taking
170 // unlimited arguments                            186 // unlimited arguments
171 template <typename _Worker, typename _Func, ty    187 template <typename _Worker, typename _Func, typename... _Args>
172 void G4THREADCREATE(_Worker*& worker, _Func fu    188 void G4THREADCREATE(_Worker*& worker, _Func func, _Args... args)
173 {                                                 189 {
174   *worker = G4Thread(func, std::forward<_Args>    190   *worker = G4Thread(func, std::forward<_Args>(args)...);
175 }                                                 191 }
176                                                   192 
177 // Conditions                                     193 // Conditions
178 //                                                194 //
179 // See G4MTRunManager for example on how to us    195 // See G4MTRunManager for example on how to use these
180 //                                                196 //
181 using G4Condition = std::condition_variable;      197 using G4Condition = std::condition_variable;
182 #  define G4CONDITION_INITIALIZER                 198 #  define G4CONDITION_INITIALIZER                                              \
183     {}                                            199     {}
184 #  define G4CONDITIONWAIT(cond, lock) (cond)->    200 #  define G4CONDITIONWAIT(cond, lock) (cond)->wait(*lock);
185 #  define G4CONDITIONWAITLAMBDA(cond, lock, la    201 #  define G4CONDITIONWAITLAMBDA(cond, lock, lambda) (cond)->wait(*lock, lambda);
186 #  define G4CONDITIONNOTIFY(cond) (cond)->noti    202 #  define G4CONDITIONNOTIFY(cond) (cond)->notify_one();
187 #  define G4CONDITIONBROADCAST(cond) (cond)->n    203 #  define G4CONDITIONBROADCAST(cond) (cond)->notify_all();
188 //                                                204 //
189 // we don't define above globally so single-th    205 // we don't define above globally so single-threaded code does not get
190 // caught in condition with no other thread to    206 // caught in condition with no other thread to wake it up
191 //                                                207 //
192                                                   208 
193 #else                                             209 #else
194 //==========================================      210 //==========================================
195 // G4MULTITHREADED is OFF - Sequential build      211 // G4MULTITHREADED is OFF - Sequential build
196 //==========================================      212 //==========================================
197                                                   213 
198 // implement a dummy thread class that acts li    214 // implement a dummy thread class that acts like a thread
199 class G4DummyThread                               215 class G4DummyThread
200 {                                                 216 {
201  public:                                          217  public:
202   using native_handle_type = G4int;               218   using native_handle_type = G4int;
203   using id                 = std::thread::id;     219   using id                 = std::thread::id;
204                                                   220 
205  public:                                          221  public:
206   // does nothing                                 222   // does nothing
207   G4DummyThread() {}                              223   G4DummyThread() {}
208   // a std::thread-like constructor that execu    224   // a std::thread-like constructor that execute upon construction
209   template <typename _Func, typename... _Args>    225   template <typename _Func, typename... _Args>
210   G4DummyThread(_Func func, _Args&&... _args)     226   G4DummyThread(_Func func, _Args&&... _args)
211   {                                               227   {
212     func(std::forward<_Args>(_args)...);          228     func(std::forward<_Args>(_args)...);
213   }                                               229   }
214                                                   230 
215  public:                                          231  public:
216   native_handle_type native_handle() const { r    232   native_handle_type native_handle() const { return native_handle_type(); }
217   G4bool joinable() const { return true; }        233   G4bool joinable() const { return true; }
218   id get_id() const noexcept { return std::thi    234   id get_id() const noexcept { return std::this_thread::get_id(); }
219   void swap(G4DummyThread&) {}                    235   void swap(G4DummyThread&) {}
220   void join() {}                                  236   void join() {}
221   void detach() {}                                237   void detach() {}
222                                                   238 
223  public:                                          239  public:
224   static unsigned int hardware_concurrency() n    240   static unsigned int hardware_concurrency() noexcept
225   {                                               241   {
226     return std::thread::hardware_concurrency()    242     return std::thread::hardware_concurrency();
227   }                                               243   }
228 };                                                244 };
229                                                   245 
230 // global thread types                            246 // global thread types
231 using G4Thread       = G4DummyThread;             247 using G4Thread       = G4DummyThread;
232 using G4NativeThread = G4DummyThread::native_h    248 using G4NativeThread = G4DummyThread::native_handle_type;
233                                                   249 
234 // mutex macros                                   250 // mutex macros
235 #  define G4MUTEXLOCK(mutex)                      251 #  define G4MUTEXLOCK(mutex)                                                   \
236     ;                                             252     ;                                                                          \
237     ;                                             253     ;
238 #  define G4MUTEXUNLOCK(mutex)                    254 #  define G4MUTEXUNLOCK(mutex)                                                 \
239     ;                                             255     ;                                                                          \
240     ;                                             256     ;
241                                                   257 
242 // Macro to join thread                           258 // Macro to join thread
243 #  define G4THREADJOIN(worker)                    259 #  define G4THREADJOIN(worker)                                                 \
244     ;                                             260     ;                                                                          \
245     ;                                             261     ;
246                                                   262 
247 using G4Pid_t = G4int;                            263 using G4Pid_t = G4int;
248                                                   264 
249 // Instead of previous macro taking one argume    265 // Instead of previous macro taking one argument, define function taking
250 // unlimited arguments                            266 // unlimited arguments
251 template <typename _Worker, typename _Func, ty    267 template <typename _Worker, typename _Func, typename... _Args>
252 void G4THREADCREATE(_Worker*& worker, _Func fu    268 void G4THREADCREATE(_Worker*& worker, _Func func, _Args... args)
253 {                                                 269 {
254   *worker = G4Thread(func, std::forward<_Args>    270   *worker = G4Thread(func, std::forward<_Args>(args)...);
255 }                                                 271 }
256                                                   272 
257 using G4Condition = G4int;                        273 using G4Condition = G4int;
258 #  define G4CONDITION_INITIALIZER 1               274 #  define G4CONDITION_INITIALIZER 1
259 #  define G4CONDITIONWAIT(cond, mutex) G4Consu    275 #  define G4CONDITIONWAIT(cond, mutex) G4ConsumeParameters(cond, mutex);
260 #  define G4CONDITIONWAITLAMBDA(cond, mutex, l    276 #  define G4CONDITIONWAITLAMBDA(cond, mutex, lambda)                           \
261     G4ConsumeParameters(cond, mutex, lambda);     277     G4ConsumeParameters(cond, mutex, lambda);
262 #  define G4CONDITIONNOTIFY(cond) G4ConsumePar    278 #  define G4CONDITIONNOTIFY(cond) G4ConsumeParameters(cond);
263 #  define G4CONDITIONBROADCAST(cond) G4Consume    279 #  define G4CONDITIONBROADCAST(cond) G4ConsumeParameters(cond);
264                                                   280 
265 #endif  // G4MULTITHREADING                       281 #endif  // G4MULTITHREADING
266                                                   282 
267 //============================================    283 //============================================================================//
268                                                   284 
269 // Define here after G4Thread has been typedef    285 // Define here after G4Thread has been typedef
270 using G4ThreadId = G4Thread::id;                  286 using G4ThreadId = G4Thread::id;
271                                                   287 
272 //============================================    288 //============================================================================//
273                                                   289 
274 namespace G4Threading                             290 namespace G4Threading
275 {                                                 291 {
276   enum                                            292   enum
277   {                                               293   {
278     SEQUENTIAL_ID    = -2,                        294     SEQUENTIAL_ID    = -2,
279     MASTER_ID        = -1,                        295     MASTER_ID        = -1,
280     WORKER_ID        = 0,                         296     WORKER_ID        = 0,
281     GENERICTHREAD_ID = -1000                      297     GENERICTHREAD_ID = -1000
282   };                                              298   };
283                                                   299 
284   G4Pid_t G4GetPidId();                           300   G4Pid_t G4GetPidId();
285   G4int G4GetNumberOfCores();                     301   G4int G4GetNumberOfCores();
286   G4int G4GetThreadId();                          302   G4int G4GetThreadId();
287   G4bool IsWorkerThread();                        303   G4bool IsWorkerThread();
288   G4bool IsMasterThread();                        304   G4bool IsMasterThread();
289   void G4SetThreadId(G4int aNewValue);            305   void G4SetThreadId(G4int aNewValue);
290   G4bool G4SetPinAffinity(G4int idx, G4NativeT    306   G4bool G4SetPinAffinity(G4int idx, G4NativeThread& at);
291   void SetMultithreadedApplication(G4bool valu    307   void SetMultithreadedApplication(G4bool value);
292   G4bool IsMultithreadedApplication();            308   G4bool IsMultithreadedApplication();
293   G4int WorkerThreadLeavesPool();                 309   G4int WorkerThreadLeavesPool();
294   G4int WorkerThreadJoinsPool();                  310   G4int WorkerThreadJoinsPool();
295   G4int GetNumberOfRunningWorkerThreads();        311   G4int GetNumberOfRunningWorkerThreads();
296 }  // namespace G4Threading                       312 }  // namespace G4Threading
297                                                   313 
298 #endif  // G4Threading_hh                         314 #endif  // G4Threading_hh
299                                                   315