"ScL Feature"/
ScL Feature 0.0.1
C++20 composable proxy wrapper with pluggable executor strategy
Loading...
Searching...
No Matches
wrapper_lock.h
1#pragma once
2
3#ifndef DOXYGEN
4
5#include <scl/feature/detail/wrapper_lock.h>
6#include <scl/feature/type_traits/wrapper.h>
7
8namespace scl
9{
10 template <typename Refer>
11 using wrapper_lock = ::scl::feature::detail::wrapper_lock<Refer>;
12} // namespace scl
13
14#else // DOXYGEN
15
16namespace scl
17{
21
44 template <typename Refer>
45 class wrapper_lock
46 {
47 public:
48 wrapper_lock(wrapper_lock &&) = delete;
49 wrapper_lock(wrapper_lock const &) = delete;
50 wrapper_lock & operator=(wrapper_lock &&) = delete;
51 wrapper_lock & operator=(wrapper_lock const &) = delete;
52
58 explicit wrapper_lock(Refer ref);
59
67
76 void lock();
77
87 void unlock();
88
94 [[nodiscard]]
95 Refer wrapper_value() const noexcept;
96
105 [[nodiscard]]
106 decltype(auto) value() const noexcept;
107 };
108 // end of group scl_feature_locking
110} // namespace scl
111
112#endif // DOXYGEN
Lazy RAII lock for a single wrapper layer.
Definition wrapper_lock.h:46
Refer wrapper_value() const noexcept
Returns the wrapper reference itself without requiring the lock.
~wrapper_lock()
Releases the guard if it was acquired.
decltype(auto) value() const noexcept
Returns the inner value through the executor.
void lock()
Acquires the guard on the executor (idempotent).
void unlock()
Releases the guard on the executor (idempotent).
wrapper_lock(Refer ref)
Constructs the lock storing ref. No guard is acquired.
Root namespace of the ScL project.