37#if defined(WIN32) || defined(__MINGW32__)
40# include <sys/syscall.h>
41# include <sys/types.h>
45#if defined(G4MULTITHREADED)
52 G4bool isMTAppType =
false;
58 return std::this_thread::get_id();
63 return std::thread::hardware_concurrency();
71# if defined(__linux__) || defined(_AIX)
74 cpu_set_t* aset =
new cpu_set_t;
78 pthread_t& _aT = (pthread_t&) (aT);
79 return (pthread_setaffinity_np(_aT,
sizeof(cpu_set_t), aset) == 0);
85 "Affinity setting not available for this architecture, "
100 std::atomic_int numActThreads(0);
106 return numActThreads.load();
115 return GetCurrentProcessId();
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4DummyThread::native_handle_type G4NativeThread
G4int WorkerThreadJoinsPool()
G4bool G4SetPinAffinity(G4int idx, G4NativeThread &at)
G4int G4GetNumberOfCores()
G4int WorkerThreadLeavesPool()
G4bool IsMultithreadedApplication()
void SetMultithreadedApplication(G4bool value)
G4int GetNumberOfRunningWorkerThreads()
void G4SetThreadId(G4int aNewValue)