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
5
6namespace yaclib::detail {
7
8template <typename Impl>
9class 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
20 YACLIB_INJECT_FAULT(auto r = Impl::try_lock_shared());
21 return r;
22 }
23
25 YACLIB_INJECT_FAULT(Impl::unlock_shared());
26 }
27};
28
29} // namespace yaclib::detail
#define YACLIB_INJECT_FAULT(statement)
Definition inject.hpp:20
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25