Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / internal / event / common / thread-local-storage.cpp
index aca21f4..86e848d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ Debug::Filter* gSingletonServiceLogFilter = Debug::Filter::New(Debug::NoLogging,
   if(gSingletonServiceLogFilter && gSingletonServiceLogFilter->IsEnabledFor(level)) \
   {                                                                                 \
     std::string string(message);                                                    \
-    Dali::TizenPlatform::LogMessage(Debug::DebugInfo, string);                      \
+    Dali::TizenPlatform::LogMessage(Debug::INFO, string);                           \
   }
 
 #define DALI_LOG_SINGLETON_SERVICE(level, format, ...) DALI_LOG_INFO(gSingletonServiceLogFilter, level, format, ##__VA_ARGS__)
@@ -51,22 +51,25 @@ namespace Internal
 {
 namespace
 {
-thread_local ThreadLocalStorage* threadLocal = nullptr;
-}
+thread_local ThreadLocalStorage* threadLocal    = nullptr;
+thread_local bool                isShuttingDown = false;
+} // namespace
 
 ThreadLocalStorage::ThreadLocalStorage(Core* core)
 : mCore(core)
 {
   DALI_ASSERT_ALWAYS(threadLocal == nullptr && "Cannot create more than one ThreadLocalStorage object");
 
-  threadLocal = this;
+  threadLocal    = this;
+  isShuttingDown = false;
 }
 
 ThreadLocalStorage::~ThreadLocalStorage() = default;
 
 void ThreadLocalStorage::Remove()
 {
-  threadLocal = nullptr;
+  threadLocal    = nullptr;
+  isShuttingDown = true;
 }
 
 ThreadLocalStorage& ThreadLocalStorage::Get()
@@ -92,6 +95,11 @@ bool ThreadLocalStorage::Created()
   return (threadLocal != nullptr);
 }
 
+bool ThreadLocalStorage::IsShuttingDown()
+{
+  return isShuttingDown;
+}
+
 ThreadLocalStorage* ThreadLocalStorage::GetInternal()
 {
   return threadLocal;