diff --git a/interfaces/kits/napi/common_event/include/common_event.h b/interfaces/kits/napi/common_event/include/common_event.h index 0300f3f6de8caeec1c87952659e51ed697d59c45..51cbd2e67bcf721409273f4d3b2cffef588dc1ca 100644 --- a/interfaces/kits/napi/common_event/include/common_event.h +++ b/interfaces/kits/napi/common_event/include/common_event.h @@ -37,7 +37,7 @@ struct subscriberInstanceInfo { std::shared_ptr commonEventResult = nullptr; }; -static napi_ref g_CommonEventSubscriber = nullptr; +static thread_local napi_ref g_CommonEventSubscriber = nullptr; static std::map, subscriberInstanceInfo> subscriberInstances; static std::mutex subscriberInsMutex; @@ -414,4 +414,4 @@ napi_value CommonEventInit(napi_env env, napi_value exports); } // namespace EventFwkNapi } // namespace OHOS -#endif // BASE_NOTIFICATION_CES_STANDARD_CESFWK_KITS_NAPI_COMMON_EVENT_INCLUDE_COMMON_EVENT_H \ No newline at end of file +#endif // BASE_NOTIFICATION_CES_STANDARD_CESFWK_KITS_NAPI_COMMON_EVENT_INCLUDE_COMMON_EVENT_H