mirror of
https://github.com/NGSolve/netgen.git
synced 2024-11-11 16:49:16 +05:00
inline GetThreadI() (except on Windows, no dllexport for thread_local variables supported)
This commit is contained in:
parent
6c73222f20
commit
a11294baf0
@ -35,11 +35,7 @@ namespace ngcore
|
||||
int TaskManager :: num_threads = 1;
|
||||
|
||||
|
||||
// #ifndef __clang__
|
||||
thread_local int TaskManager :: thread_id = 0;
|
||||
// #else
|
||||
// __thread int TaskManager :: thread_id;
|
||||
// #endif
|
||||
|
||||
const function<void(TaskInfo&)> * TaskManager::func;
|
||||
const function<void()> * TaskManager::startup_function = nullptr;
|
||||
@ -174,10 +170,12 @@ namespace ngcore
|
||||
num_threads = 1;
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
int TaskManager :: GetThreadId()
|
||||
{
|
||||
return thread_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
void TaskManager :: StartWorkers()
|
||||
{
|
||||
|
@ -78,12 +78,11 @@ namespace ngcore
|
||||
|
||||
|
||||
|
||||
// #ifndef __clang__
|
||||
#ifdef WIN32 // no exported thread_local in dlls on Windows
|
||||
static thread_local int thread_id;
|
||||
// #else
|
||||
// static __thread int thread_id;
|
||||
// #endif
|
||||
|
||||
#else
|
||||
NGCORE_API static thread_local int thread_id;
|
||||
#endif
|
||||
NGCORE_API static bool use_paje_trace;
|
||||
public:
|
||||
|
||||
@ -102,11 +101,15 @@ namespace ngcore
|
||||
void ResumeWorkers() { sleep = false; }
|
||||
|
||||
NGCORE_API static void SetNumThreads(int amax_threads);
|
||||
NGCORE_API static int GetMaxThreads() { return max_threads; }
|
||||
static int GetMaxThreads() { return max_threads; }
|
||||
// static int GetNumThreads() { return task_manager ? task_manager->num_threads : 1; }
|
||||
NGCORE_API static int GetNumThreads() { return num_threads; }
|
||||
static int GetNumThreads() { return num_threads; }
|
||||
#ifdef WIN32
|
||||
NGCORE_API static int GetThreadId();
|
||||
NGCORE_API int GetNumNodes() const { return num_nodes; }
|
||||
#else
|
||||
static int GetThreadId() { return thread_id; }
|
||||
#endif
|
||||
int GetNumNodes() const { return num_nodes; }
|
||||
|
||||
static void SetPajeTrace (bool use) { use_paje_trace = use; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user