46 #include <sys/types.h>
47 #include <sys/syscall.h>
50 #if defined(G4MULTITHREADED)
57 G4bool isMTAppType =
false;
63 return std::this_thread::get_id();
68 return std::thread::hardware_concurrency();
76 #if defined(__linux__) || defined(_AIX)
79 cpu_set_t* aset =
new cpu_set_t;
83 pthread_t& _aT = (pthread_t&) (aT);
84 return (pthread_setaffinity_np(_aT,
sizeof(cpu_set_t), aset) == 0);
86 #else //Not available for Mac, WIN,...
91 "Affinity setting not available for this architecture, "
109 std::atomic_int numActThreads(0);
115 #else // Sequential mode
121 return GetCurrentProcessId();
int WorkerThreadJoinsPool()
G4int G4GetNumberOfCores()
int WorkerThreadLeavesPool()
G4int GetNumberOfRunningWorkerThreads()
const XML_Char int const XML_Char * value
G4bool G4SetPinAffinity(G4int idx, G4NativeThread &at)
void SetMultithreadedApplication(G4bool value)
G4DummyThread::native_handle_type G4NativeThread
void G4SetThreadId(G4int aNewValue)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4bool IsMultithreadedApplication()