YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
atomic_flag.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <yaclib/config.hpp>
4
#include <
yaclib/fault/detail/fiber/atomic_wait.hpp
>
5
#include <
yaclib/fault/inject.hpp
>
6
7
namespace
yaclib::detail::fiber
{
8
9
class
AtomicFlag
:
public
AtomicWait
<bool> {
10
using
Base
=
AtomicWait<bool>
;
11
12
public
:
13
using
Base::Base;
14
15
void
clear
(std::memory_order)
volatile
noexcept
{
16
_value
=
false
;
17
}
18
void
clear
(std::memory_order)
noexcept
{
19
_value
=
false
;
20
}
21
22
bool
test_and_set
(std::memory_order)
volatile
noexcept
{
23
auto
val
=
_value
;
24
_value
=
true
;
25
return
val
;
26
}
27
bool
test_and_set
(std::memory_order)
noexcept
{
28
auto
val
=
_value
;
29
_value
=
true
;
30
return
val
;
31
}
32
33
#if YACLIB_FUTEX != 0
34
bool
test
(std::memory_order)
const
volatile
noexcept
{
35
return
_value
;
36
}
37
bool
test
(std::memory_order)
const
noexcept
{
38
return
_value
;
39
}
40
#endif
41
private
:
42
using
Base::_value
;
43
};
44
45
}
// namespace yaclib::detail::fiber
yaclib::detail::fiber::AtomicFlag
Definition
atomic_flag.hpp:9
yaclib::detail::fiber::AtomicFlag::test_and_set
bool test_and_set(std::memory_order) noexcept
Definition
atomic_flag.hpp:27
yaclib::detail::fiber::AtomicFlag::test_and_set
bool test_and_set(std::memory_order) volatile noexcept
Definition
atomic_flag.hpp:22
yaclib::detail::fiber::AtomicFlag::clear
void clear(std::memory_order) volatile noexcept
Definition
atomic_flag.hpp:15
yaclib::detail::fiber::AtomicFlag::clear
void clear(std::memory_order) noexcept
Definition
atomic_flag.hpp:18
yaclib::detail::fiber::AtomicWait
Definition
atomic_wait.hpp:10
yaclib::detail::fiber::AtomicWait< bool >::_value
bool _value
Definition
atomic_wait.hpp:63
atomic_wait.hpp
inject.hpp
test
Definition
when_all.cpp:19
yaclib::detail::fiber
Definition
atomic.hpp:7
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
include
yaclib
fault
detail
fiber
atomic_flag.hpp
Generated by
1.9.8