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/mutex.hpp
>
4
#include <
yaclib/fault/inject.hpp
>
5
6
namespace
yaclib::detail
{
7
8
template
<
typename
Impl>
9
class
SharedMutex
:
public
Mutex
<Impl> {
10
using
Base
=
Mutex<Impl>
;
11
12
public
:
13
using
Base::Base;
14
15
void
lock_shared
() {
16
YACLIB_INJECT_FAULT
(Impl::lock_shared());
17
}
18
19
bool
try_lock_shared
() {
20
YACLIB_INJECT_FAULT
(
auto
r
= Impl::try_lock_shared());
21
return
r
;
22
}
23
24
void
unlock_shared
() {
25
YACLIB_INJECT_FAULT
(Impl::unlock_shared());
26
}
27
};
28
29
}
// namespace yaclib::detail
yaclib::detail::Mutex
Definition
mutex.hpp:8
yaclib::detail::SharedMutex
Definition
shared_mutex.hpp:9
yaclib::detail::SharedMutex::lock_shared
void lock_shared()
Definition
shared_mutex.hpp:15
yaclib::detail::SharedMutex::unlock_shared
void unlock_shared()
Definition
shared_mutex.hpp:24
yaclib::detail::SharedMutex::try_lock_shared
bool try_lock_shared()
Definition
shared_mutex.hpp:19
mutex.hpp
inject.hpp
YACLIB_INJECT_FAULT
#define YACLIB_INJECT_FAULT(statement)
Definition
inject.hpp:20
yaclib::detail
Definition
base_core.hpp:18
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
include
yaclib
fault
detail
shared_mutex.hpp
Generated by
1.9.8