From 47bdb4ef1ddeba682d28dd9479b3570eb76337f6 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Sun, 7 Feb 2021 12:59:46 +0800 Subject: [PATCH] fix(mgb/core): add MGB_HAVE_THREAD macro to thread_local GitOrigin-RevId: cfcb50b041175e801a35fec1e16bb408403594c7 --- src/core/impl/comp_node/cpu/comp_node.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/impl/comp_node/cpu/comp_node.cpp b/src/core/impl/comp_node/cpu/comp_node.cpp index 140a8cec..4fc6657a 100644 --- a/src/core/impl/comp_node/cpu/comp_node.cpp +++ b/src/core/impl/comp_node/cpu/comp_node.cpp @@ -247,7 +247,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase { //! https://github.com/tensorflow/tensorflow/issues/18356 //! thread local is no support on IOS, //! When update x-xode, this code should be deleted -#ifndef IOS +#if !defined(IOS) && MGB_HAVE_THREAD static thread_local SeqRecorderImpl* sm_cur_recorder; #else SeqRecorderImpl* sm_cur_recorder = nullptr; @@ -463,7 +463,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase { } //! current sequence recorder of this thread -#ifndef IOS +#if !defined(IOS) && MGB_HAVE_THREAD static SeqRecorderImpl* cur_recorder() { return sm_cur_recorder; } #else SeqRecorderImpl* cur_recorder() { return sm_cur_recorder; } @@ -479,7 +479,7 @@ class CpuCompNode::CompNodeImpl final: public CpuDispatchableBase { }; MGB_DYN_TYPE_OBJ_FINAL_IMPL(CpuCompNodeImpl); CpuCompNodeImpl* CpuCompNodeImpl::sm_default_cpu_comp_node_ptr; -#ifndef IOS +#if !defined(IOS) && MGB_HAVE_THREAD thread_local CpuCompNode::SeqRecorderImpl* CpuCompNodeImpl::sm_cur_recorder = nullptr; #endif -- GitLab