Expose API to notify about variable value change

This commit is contained in:
WarmUpTill
2026-06-13 23:24:21 +02:00
committed by WarmUpTill
parent eded0367db
commit 3a556113aa
2 changed files with 20 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
#include "item-selection-helpers.hpp"
#include "resizing-text-edit.hpp"
#include <condition_variable>
#include <mutex>
#include <obs-data.h>
#include <optional>
@@ -43,6 +44,11 @@ public:
std::optional<uint64_t> GetSecondsSinceLastUse() const;
std::optional<uint64_t> GetSecondsSinceLastChange() const;
void MarkAsUsed() const;
EXPORT std::condition_variable &GetCV() { return _cv; }
EXPORT std::unique_lock<std::mutex> GetCVLock()
{
return std::unique_lock<std::mutex>(_cvMutex);
}
private:
SaveAction _saveAction = SaveAction::DONT_SAVE;
@@ -53,6 +59,8 @@ private:
mutable std::chrono::high_resolution_clock::time_point _lastUsed;
mutable std::chrono::high_resolution_clock::time_point _lastChanged;
mutable std::mutex _mutex;
std::mutex _cvMutex;
std::condition_variable _cv;
void UpdateLastUsed() const;