[Common] Changed CurrentApplication to thread local 60/318560/1
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 20 Jan 2025 11:47:32 +0000 (12:47 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Mon, 20 Jan 2025 11:47:35 +0000 (12:47 +0100)
CurrentApplication can be accessed by different threads of wrt-services

To protect it from parallel access, it become thread local.

[Verification] Code compiles without errors.

Change-Id: Ic3f20db211a3eb00649b152542deb4a3901ffe7c

src/common/current_application.cc

index e99e6b8945b645e522a72fdf2838371a417e96bb..7f5c2e8880d8f2f137a4ec1d852f5f709cf8d95c 100644 (file)
@@ -37,7 +37,7 @@ std::string GetRuntimeVariable(const char* variable_name) {
 
 CurrentApplication &CurrentApplication::GetInstance() {
   ScopeLogger();
-  static CurrentApplication current_application;
+  thread_local CurrentApplication current_application;
   return current_application;
 }