/*
- * Copyright (c) 2022 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.
Actor* parentActor = static_cast<Actor*>(parent);
mScene = parentActor->mScene;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
parentActor->OnScene())
{
// Instruct each actor to create a corresponding node in the scene graph
mParent = nullptr;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
OnScene())
{
// Disconnect the Node & its children from the scene-graph.
/*
- * 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.
return ThreadLocalStorage::Created();
}
+bool EventThreadServices::IsShuttingDown()
+{
+ return ThreadLocalStorage::IsShuttingDown();
+}
+
} // namespace Internal
} // namespace Dali
#define DALI_INTERNAL_EVENT_THREAD_SERVICES_H
/*
- * 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.
/**
* @return true if core is still running and we can send messages
+ * @note It returns false if it is called from a thread other than the main thread.
*/
static bool IsCoreRunning();
+
+ /**
+ * @brief Check if the event thread service is shutting down.
+ *
+ * @return true if the event thread service is shutting down.
+ * @note It returns false if the core hasn't been initialised yet.
+ */
+ static bool IsShuttingDown();
};
} // namespace Internal
/*
- * Copyright (c) 2022 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.
{
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()
return (threadLocal != nullptr);
}
+bool ThreadLocalStorage::IsShuttingDown()
+{
+ return isShuttingDown;
+}
+
ThreadLocalStorage* ThreadLocalStorage::GetInternal()
{
return threadLocal;
#define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
/*
- * 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.
static bool Created();
/**
+ * Checks if the system is shutting down
+ * @return true if the system is shutting down
+ * @note It returns false if the core hasn't been initialised yet.
+ */
+ static bool IsShuttingDown();
+
+ /**
* Get a pointer to the TLS or NULL if not initialized
* @return pointer to the TLS
*/