YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
mutex.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
yaclib/fault/inject.hpp
>
4
5
namespace
yaclib::detail
{
6
7
template
<
typename
Impl>
8
class
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;
30
impl_t
&
GetImpl
() {
31
return
*
this
;
32
}
33
};
34
35
}
// namespace yaclib::detail
yaclib::detail::Mutex
Definition
mutex.hpp:8
yaclib::detail::Mutex::impl_t
Impl impl_t
Internal.
Definition
mutex.hpp:29
yaclib::detail::Mutex::unlock
void unlock()
Definition
mutex.hpp:24
yaclib::detail::Mutex::GetImpl
impl_t & GetImpl()
Definition
mutex.hpp:30
yaclib::detail::Mutex::try_lock
bool try_lock()
Definition
mutex.hpp:19
yaclib::detail::Mutex::lock
void lock()
Definition
mutex.hpp:15
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
mutex.hpp
Generated by
1.9.8