diff --git a/src/runtime/thread_pool.cc b/src/runtime/thread_pool.cc index 71052626ae5a084429134a6cd9f9787624e60190..b7ea6f5b81d38bb43a2337e96d30ffe55bdc34ff 100644 --- a/src/runtime/thread_pool.cc +++ b/src/runtime/thread_pool.cc @@ -291,9 +291,8 @@ class ThreadPool { return res; } - static ThreadPool* Global() { - static ThreadPool inst; - return &inst; + static ThreadPool* ThreadLocal() { + return dmlc::ThreadLocalStore<ThreadPool>::Get(); } private: @@ -331,7 +330,7 @@ int TVMBackendParallelLaunch( FTVMParallelLambda flambda, void* cdata, int num_task) { - int res = tvm::runtime::ThreadPool::Global()->Launch( + int res = tvm::runtime::ThreadPool::ThreadLocal()->Launch( flambda, cdata, num_task, 1); return res; }