|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
RAII-based scoped lock guard with timeout support. More...
#include <sync_primitives.h>

Public Member Functions | |
| scoped_lock_guard (Mutex &mutex) | |
| Construct and immediately acquire the lock. | |
| template<typename Rep , typename Period > | |
| scoped_lock_guard (Mutex &mutex, const std::chrono::duration< Rep, Period > &timeout) | |
| Construct and try to acquire the lock with timeout. | |
| ~scoped_lock_guard () | |
| Destructor - automatically releases the lock if held. | |
| scoped_lock_guard (const scoped_lock_guard &)=delete | |
| scoped_lock_guard & | operator= (const scoped_lock_guard &)=delete |
| scoped_lock_guard (scoped_lock_guard &&)=delete | |
| scoped_lock_guard & | operator= (scoped_lock_guard &&)=delete |
| bool | owns_lock () const noexcept |
| Check if the lock was successfully acquired. | |
| void | unlock () |
| Explicitly release the lock before destruction. | |
| scoped_lock_guard (Mutex &mutex) | |
| Construct and immediately acquire the lock. | |
| template<typename Rep , typename Period > | |
| scoped_lock_guard (Mutex &mutex, const std::chrono::duration< Rep, Period > &timeout) | |
| Construct and try to acquire the lock with timeout. | |
| ~scoped_lock_guard () | |
| Destructor - automatically releases the lock if held. | |
| scoped_lock_guard (const scoped_lock_guard &)=delete | |
| scoped_lock_guard & | operator= (const scoped_lock_guard &)=delete |
| scoped_lock_guard (scoped_lock_guard &&)=delete | |
| scoped_lock_guard & | operator= (scoped_lock_guard &&)=delete |
| bool | owns_lock () const noexcept |
| Check if the lock was successfully acquired. | |
| void | unlock () |
| Explicitly release the lock before destruction. | |
Private Attributes | |
| Mutex & | mutex_ |
| bool | locked_ |
RAII-based scoped lock guard with timeout support.
This class provides automatic lock management with optional timeout capabilities, ensuring locks are always released even in exceptional situations.
|
inlineexplicit |
Construct and immediately acquire the lock.
| mutex | The mutex to lock |
Definition at line 27 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
inline |
Construct and try to acquire the lock with timeout.
| mutex | The mutex to lock |
| timeout | Maximum time to wait for the lock |
Definition at line 38 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
inline |
Destructor - automatically releases the lock if held.
Definition at line 52 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
delete |
|
delete |
|
inlineexplicit |
Construct and immediately acquire the lock.
| mutex | The mutex to lock |
Definition at line 33 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
inline |
Construct and try to acquire the lock with timeout.
| mutex | The mutex to lock |
| timeout | Maximum time to wait for the lock |
Definition at line 44 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
inline |
Destructor - automatically releases the lock if held.
Definition at line 58 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
delete |
|
delete |
|
delete |
|
delete |
|
delete |
|
delete |
|
inlinenodiscardnoexcept |
Check if the lock was successfully acquired.
Definition at line 68 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_.
|
inlinenodiscardnoexcept |
Check if the lock was successfully acquired.
Definition at line 74 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_.
|
inline |
Explicitly release the lock before destruction.
Definition at line 75 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
inline |
Explicitly release the lock before destruction.
Definition at line 81 of file sync_primitives.h.
References kcenon::thread::sync::scoped_lock_guard< Mutex >::locked_, and kcenon::thread::sync::scoped_lock_guard< Mutex >::mutex_.
|
private |
Definition at line 84 of file sync_primitives.h.
Referenced by kcenon::thread::sync::scoped_lock_guard< Mutex >::owns_lock(), kcenon::thread::sync::scoped_lock_guard< Mutex >::scoped_lock_guard(), kcenon::thread::sync::scoped_lock_guard< Mutex >::unlock(), and kcenon::thread::sync::scoped_lock_guard< Mutex >::~scoped_lock_guard().
|
private |
Definition at line 83 of file sync_primitives.h.
Referenced by kcenon::thread::sync::scoped_lock_guard< Mutex >::scoped_lock_guard(), kcenon::thread::sync::scoped_lock_guard< Mutex >::scoped_lock_guard(), kcenon::thread::sync::scoped_lock_guard< Mutex >::unlock(), and kcenon::thread::sync::scoped_lock_guard< Mutex >::~scoped_lock_guard().