!18633 [LITE][IOS] fix compile mindrt threadpool

Merge pull request !18633 from yefeng/126-fix_ios_compile
This commit is contained in:
i-robot 2021-06-21 19:26:14 +08:00 committed by Gitee
commit e2494379f6
2 changed files with 4 additions and 0 deletions

View File

@ -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

View File

@ -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;