From d28f2cfcd4249fc7d984762a326e3f2d6dcba7dc Mon Sep 17 00:00:00 2001 From: Douglas Rumbaugh Date: Thu, 13 Feb 2025 18:13:33 -0500 Subject: progress towards resolving asynch structure merges --- include/framework/scheduling/LockManager.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/framework/scheduling') diff --git a/include/framework/scheduling/LockManager.h b/include/framework/scheduling/LockManager.h index 91ed778..fcc79d1 100644 --- a/include/framework/scheduling/LockManager.h +++ b/include/framework/scheduling/LockManager.h @@ -46,7 +46,21 @@ public: return false; } + bool take_buffer_lock() { + bool old = m_buffer_lk.load(); + if (!old) { + return m_buffer_lk.compare_exchange_strong(old, true); + } + + return false; + } + + void release_buffer_lock() { + m_buffer_lk.store(false); + } + private: std::deque> m_lks; + std::atomic m_buffer_lk; }; } -- cgit v1.2.3