35 lines
735 B
C++
35 lines
735 B
C++
/*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include <condition_variable>
|
|
#include <mutex>
|
|
#include <string_view>
|
|
|
|
namespace openVulkanoCpp
|
|
{
|
|
class IEventHandler;
|
|
|
|
class ThreadBackgroundSleep final
|
|
{
|
|
std::mutex m_mutex;
|
|
std::condition_variable m_condVar;
|
|
bool m_inBackground = false;
|
|
IEventHandler* m_resignHandler = nullptr;
|
|
IEventHandler* m_resumeHandler = nullptr;
|
|
|
|
public:
|
|
static ThreadBackgroundSleep INSTANCE;
|
|
|
|
ThreadBackgroundSleep();
|
|
|
|
~ThreadBackgroundSleep();
|
|
|
|
void Resume();
|
|
|
|
void CheckForBackground(std::string_view taskName);
|
|
};
|
|
}
|