From b26286d9cd767cd3d2b03dce1dc8e580a8f7389c Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 10 Jul 2019 15:21:04 +0200 Subject: [PATCH] Fix thread_id linkage --- libsrc/core/taskmanager.cpp | 6 +----- libsrc/core/taskmanager.hpp | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libsrc/core/taskmanager.cpp b/libsrc/core/taskmanager.cpp index a411034b..b54264f1 100644 --- a/libsrc/core/taskmanager.cpp +++ b/libsrc/core/taskmanager.cpp @@ -41,8 +41,6 @@ namespace ngcore __thread int TaskManager :: thread_id; #endif - thread_local int thread_id = 0; - const function * TaskManager::func; const function * TaskManager::startup_function = nullptr; const function * TaskManager::cleanup_function = nullptr; @@ -188,12 +186,10 @@ namespace ngcore num_threads = 1; } - /* int TaskManager :: GetThreadId() { return thread_id; } - */ void TaskManager :: StartWorkers() { @@ -293,7 +289,7 @@ namespace ngcore TaskInfo ti; ti.task_nr = task.mynr; ti.ntasks = task.total; - ti.thread_nr = thread_id; + ti.thread_nr = TaskManager::GetThreadId(); ti.nthreads = TaskManager::GetNumThreads(); /* { diff --git a/libsrc/core/taskmanager.hpp b/libsrc/core/taskmanager.hpp index 059a1678..4e057013 100644 --- a/libsrc/core/taskmanager.hpp +++ b/libsrc/core/taskmanager.hpp @@ -98,7 +98,7 @@ namespace ngcore NGCORE_API 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; } - NGCORE_API static int GetThreadId() { return thread_id; } + NGCORE_API static int GetThreadId(); NGCORE_API int GetNumNodes() const { return num_nodes; } static void SetPajeTrace (bool use) { use_paje_trace = use; }