YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
mutex.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace yaclib::detail {
6
7template <typename Impl>
8class Mutex : protected Impl {
9 public:
10 using Impl::Impl;
11#ifndef _MSC_VER
12 using Impl::native_handle;
13#endif
14
15 void lock() {
16 YACLIB_INJECT_FAULT(Impl::lock());
17 }
18
19 bool try_lock() {
20 YACLIB_INJECT_FAULT(auto r = Impl::try_lock());
21 return r;
22 }
23
24 void unlock() {
25 YACLIB_INJECT_FAULT(Impl::unlock());
26 }
27
28 /// Internal
29 using impl_t = Impl;
31 return *this;
32 }
33};
34
35} // namespace yaclib::detail
Impl impl_t
Internal.
Definition mutex.hpp:29
impl_t & GetImpl()
Definition mutex.hpp:30
#define YACLIB_INJECT_FAULT(statement)
Definition inject.hpp:20
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25