userver
C++ Async Framework
Loading...
Searching...
No Matches
asymmetric_fence.hpp
1
#
pragma
once
2
3
USERVER_NAMESPACE_BEGIN
4
5
namespace
concurrent
::impl {
6
7
// A pair of AsymmetricThreadFenceLight + AsymmetricThreadFenceHeavy
8
// synchronizes like std::atomic_thread_fence(std::memory_order_seq_cst)
9
//
10
// Light version is very fast (~1ns) and Heavy version is quite slow
11
// (1 context switch per CPU core ~1us).
12
//
13
// Supported systems: x86_64 Linux with kernel version 4.14+.
14
// On other systems, these are implemented as
15
// std::atomic_thread_fence(std::memory_order_seq_cst).
16
//
17
// See:
18
// https://man.archlinux.org/man/membarrier.2.ru
19
// https://wg21.link/p1202
20
// https://github.com/facebook/folly/blob/main/folly/synchronization/AsymmetricThreadFence.cpp
21
void
AsymmetricThreadFenceLight()
noexcept
;
22
void
AsymmetricThreadFenceHeavy()
noexcept
;
23
24
// Automatic thread registration for asymmetric thread fences uses
25
// an unprotected thread_local access. On thread pools of thread-migrating
26
// coroutines, this should be called before any AsymmetricThreadFence* calls.
27
void
AsymmetricThreadFenceForceRegisterThread()
noexcept
;
28
29
}
// namespace concurrent::impl
30
31
USERVER_NAMESPACE_END
userver
concurrent
impl
asymmetric_fence.hpp
Generated on Wed May 15 2024 22:15:50 for userver by
Doxygen
1.10.0