From e6f9071b4186d243c1ec8af261fed0382f9d379e Mon Sep 17 00:00:00 2001 From: yefeng Date: Mon, 21 Jun 2021 14:36:31 +0800 Subject: [PATCH] fix ios compile mindrt threadpool --- mindspore/core/mindrt/src/thread/actor_threadpool.cc | 2 ++ mindspore/core/mindrt/src/thread/threadpool.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mindspore/core/mindrt/src/thread/actor_threadpool.cc b/mindspore/core/mindrt/src/thread/actor_threadpool.cc index 27885b656be..738c4132172 100644 --- a/mindspore/core/mindrt/src/thread/actor_threadpool.cc +++ b/mindspore/core/mindrt/src/thread/actor_threadpool.cc @@ -24,8 +24,10 @@ void ActorWorker::CreateThread(ActorThreadPool *pool) { } void ActorWorker::Run() { +#ifndef __APPLE__ static std::atomic_int index = 0; pthread_setname_np(pthread_self(), ("ActorThread_" + std::to_string(index++)).c_str()); +#endif while (alive_) { // only run either local KernelTask or PoolQueue ActorTask #ifdef ENABLE_MINDRT diff --git a/mindspore/core/mindrt/src/thread/threadpool.cc b/mindspore/core/mindrt/src/thread/threadpool.cc index 9cdc714fa55..d266213cb52 100644 --- a/mindspore/core/mindrt/src/thread/threadpool.cc +++ b/mindspore/core/mindrt/src/thread/threadpool.cc @@ -32,8 +32,10 @@ Worker::~Worker() { void Worker::CreateThread() { thread_ = std::thread(&Worker::Run, this); } void Worker::Run() { +#ifndef __APPLE__ static std::atomic_int index = 0; pthread_setname_np(pthread_self(), ("KernelThread_" + std::to_string(index++)).c_str()); +#endif while (alive_) { if (RunLocalKernelTask()) { spin_count_ = 0;