mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 01:05:53 -05:00
Add additional sync-helpers to reduce dependencies to switcher-data
This commit is contained in:
@@ -14,6 +14,11 @@ std::mutex *GetSwitcherMutex()
|
||||
return switcher ? &switcher->m : nullptr;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> *GetSwitcherLoopLock()
|
||||
{
|
||||
return switcher ? switcher->mainLoopLock : nullptr;
|
||||
}
|
||||
|
||||
bool VerboseLoggingEnabled()
|
||||
{
|
||||
return switcher ? switcher->verbose : false;
|
||||
|
||||
@@ -3,9 +3,21 @@
|
||||
namespace advss {
|
||||
|
||||
std::mutex *GetSwitcherMutex();
|
||||
std::unique_lock<std::mutex> *GetSwitcherLoopLock();
|
||||
|
||||
std::mutex *GetMutex()
|
||||
{
|
||||
return GetSwitcherMutex();
|
||||
}
|
||||
|
||||
std::lock_guard<std::mutex> LockContext()
|
||||
{
|
||||
return std::lock_guard<std::mutex>(*GetSwitcherMutex());
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> *GetLoopLock()
|
||||
{
|
||||
return GetSwitcherLoopLock();
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
namespace advss {
|
||||
|
||||
[[nodiscard]] std::mutex *GetMutex();
|
||||
[[nodiscard]] std::lock_guard<std::mutex> LockContext();
|
||||
[[nodiscard]] std::unique_lock<std::mutex> *GetLoopLock();
|
||||
|
||||
} // namespace advss
|
||||
|
||||
Reference in New Issue
Block a user