46 #include <sys/types.h>
47 #include <sys/syscall.h>
50 #if defined(G4MULTITHREADED)
55 G4bool isMTAppType =
false;
61 return syscall(SYS_thread_selfid);
63 return GetCurrentThreadId();
65 return syscall(SYS_gettid);
73 GetSystemInfo( &sysinfo );
74 return static_cast<G4int>( sysinfo.dwNumberOfProcessors );
76 return static_cast<G4int>(sysconf( _SC_NPROCESSORS_ONLN ));
84 #if defined(WIN32) // WIN32 stuff needed for MT
85 DWORD G4WaitForSingleObjectInf( __in
G4Mutex m )
86 {
return WaitForSingleObject( m , INFINITE); }
88 {
return ReleaseMutex(m); }
91 #if defined(__linux__) || defined(_AIX)
94 cpu_set_t* aset =
new cpu_set_t;
98 return ( pthread_setaffinity_np(aT,
sizeof(cpu_set_t), aset) == 0 );
100 #else //Not available for Mac, WIN,...
105 "Affinity setting not available for this architecture, ignoring...");
113 #else // Sequential mode
120 return GetCurrentProcessId();
G4bool G4SetPinAffinity(G4int idx, G4Thread &at)
void SetMultithreadedApplication(G4bool value)
void G4SetThreadId(G4int aNewValue)
G4int G4GetNumberOfCores()
G4bool IsMultithreadedApplication()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4int fake_mutex_lock_unlock(G4Mutex *)