YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
atomic.cpp
Go to the documentation of this file.
1
#include <
fault/util.hpp
>
2
3
#include <
yaclib/fault/detail/atomic.hpp
>
4
5
#include <atomic>
6
7
namespace
yaclib::detail
{
8
9
static
std::uint32_t
sAtomicFailFrequency
= 13;
10
11
bool
ShouldFailAtomicWeak
() {
12
auto
freq
=
sAtomicFailFrequency
;
13
return
freq
!= 0 &&
GetRandNumber
(
freq
) == 0;
14
}
15
16
void
SetAtomicWeakFailFrequency
(std::uint32_t
k
) {
17
sAtomicFailFrequency
=
k
;
18
}
19
20
}
// namespace yaclib::detail
atomic.hpp
yaclib::detail
Definition
base_core.hpp:18
yaclib::detail::GetRandNumber
std::uint64_t GetRandNumber(std::uint64_t max)
Definition
util.cpp:22
yaclib::detail::sAtomicFailFrequency
static std::uint32_t sAtomicFailFrequency
Definition
atomic.cpp:9
yaclib::detail::SetAtomicWeakFailFrequency
void SetAtomicWeakFailFrequency(std::uint32_t k)
Definition
atomic.cpp:16
yaclib::detail::ShouldFailAtomicWeak
bool ShouldFailAtomicWeak()
Definition
atomic.cpp:11
yaclib::MakeContract
Contract< V, E > MakeContract()
Creates related future and promise.
Definition
contract.hpp:25
util.hpp
src
fault
atomic.cpp
Generated by
1.9.8