YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
shared_mutex.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
yaclib/fault/detail/fiber/queue.hpp
>
4
5
namespace
yaclib::detail::fiber
{
6
7
class
SharedMutex
{
8
public
:
9
SharedMutex
() =
default
;
10
~SharedMutex
()
noexcept
=
default
;
11
12
SharedMutex
(
const
SharedMutex
&) =
delete
;
13
SharedMutex
&
operator
=(
const
SharedMutex
&) =
delete
;
14
15
void
lock
();
16
bool
try_lock
()
noexcept
;
17
void
unlock
()
noexcept
;
18
19
void
lock_shared
();
20
21
bool
try_lock_shared
();
22
23
void
unlock_shared
();
24
25
using
native_handle_type
=
void
*;
26
27
inline
native_handle_type
native_handle
();
28
29
protected
:
30
void
LockHelper
();
31
void
SharedLockHelper
();
32
33
FiberQueue
_shared_queue
;
34
FiberQueue
_exclusive_queue
;
35
std::uint32_t
_shared_owners_count
{0};
36
bool
_occupied
{
false
};
37
bool
_exclusive_mode
{
false
};
38
};
39
40
}
// namespace yaclib::detail::fiber
yaclib::detail::fiber::FiberQueue
Definition
queue.hpp:14
yaclib::detail::fiber::SharedMutex
Definition
shared_mutex.hpp:7
yaclib::detail::fiber::SharedMutex::lock_shared
void lock_shared()
Definition
shared_mutex.cpp:32
yaclib::detail::fiber::SharedMutex::LockHelper
void LockHelper()
Definition
shared_mutex.cpp:55
yaclib::detail::fiber::SharedMutex::SharedMutex
SharedMutex()=default
yaclib::detail::fiber::SharedMutex::unlock
void unlock() noexcept
Definition
shared_mutex.cpp:22
yaclib::detail::fiber::SharedMutex::_exclusive_mode
bool _exclusive_mode
Definition
shared_mutex.hpp:37
yaclib::detail::fiber::SharedMutex::_shared_owners_count
std::uint32_t _shared_owners_count
Definition
shared_mutex.hpp:35
yaclib::detail::fiber::SharedMutex::try_lock_shared
bool try_lock_shared()
Definition
shared_mutex.cpp:39
yaclib::detail::fiber::SharedMutex::SharedLockHelper
void SharedLockHelper()
Definition
shared_mutex.cpp:60
yaclib::detail::fiber::SharedMutex::native_handle_type
void * native_handle_type
Definition
shared_mutex.hpp:25
yaclib::detail::fiber::SharedMutex::unlock_shared
void unlock_shared()
Definition
shared_mutex.cpp:47
yaclib::detail::fiber::SharedMutex::_shared_queue
FiberQueue _shared_queue
Definition
shared_mutex.hpp:33
yaclib::detail::fiber::SharedMutex::_occupied
bool _occupied
Definition
shared_mutex.hpp:36
yaclib::detail::fiber::SharedMutex::lock
void lock()
Definition
shared_mutex.cpp:7
yaclib::detail::fiber::SharedMutex::~SharedMutex
~SharedMutex() noexcept=default
yaclib::detail::fiber::SharedMutex::native_handle
native_handle_type native_handle()
Definition
shared_mutex.cpp:66
yaclib::detail::fiber::SharedMutex::_exclusive_queue
FiberQueue _exclusive_queue
Definition
shared_mutex.hpp:34
yaclib::detail::fiber::SharedMutex::try_lock
bool try_lock() noexcept
Definition
shared_mutex.cpp:14
yaclib::detail::fiber
Definition
atomic.hpp:7
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
queue.hpp
include
yaclib
fault
detail
fiber
shared_mutex.hpp
Generated by
1.9.8