YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
yaclib::detail Namespace Reference

Namespaces

namespace  fiber
 
namespace  thread
 

Classes

class  AllCombinator
 
class  AllCombinator< OrderPolicy::Same, R, E >
 
struct  AllCombinatorBase
 
struct  AllCombinatorBase< OrderPolicy::Fifo, bool >
 
struct  AllCombinatorBase< OrderPolicy::Fifo, Result< V, E > >
 
struct  AllCombinatorBase< OrderPolicy::Fifo, V >
 
struct  AllCombinatorBase< OrderPolicy::Fifo, void >
 
struct  AllCombinatorBase< OrderPolicy::Same, Result< V, E > >
 
struct  AllCombinatorBase< OrderPolicy::Same, void >
 
class  AnyCombinator
 
class  AnyCombinatorBase
 
class  AnyCombinatorBase< V, E, FailPolicy::FirstFail >
 
class  AnyCombinatorBase< V, E, FailPolicy::LastFail >
 
class  Atomic
 
class  Atomic< Impl, U * >
 
class  AtomicBase
 
struct  AtomicCounter
 
class  AtomicEvent
 
class  AtomicFlag
 
class  AtomicFloatingBase
 
class  AtomicFloatingBase< Impl, T, true >
 
class  AtomicIntegralBase
 
class  AtomicIntegralBase< Impl, T, true >
 
class  AtomicWait
 
struct  AwaitAwaiter
 TODO(mkornaukhov03) Add doxygen docs. More...
 
class  AwaitAwaiter< false >
 
class  AwaitEvent
 
struct  AwaitOnAwaiter
 
class  AwaitOnAwaiter< false >
 
class  AwaitOnEvent
 
class  AwaitSingleAwaiter
 
class  BaseCore
 
struct  Callback
 
struct  CallCallback
 
class  ConditionVariable
 
class  ConditionVariableAny
 
class  Core
 
class  CurrentAwaiter
 
struct  DefaultDeleter
 
struct  Destroy
 
struct  DropCallback
 
class  FuncCore
 
struct  FutureBaseTypes
 
struct  FutureBaseTypes< Future< V, E > >
 
struct  FutureBaseTypes< FutureBase< V, E > >
 
struct  FutureBaseTypes< FutureOn< V, E > >
 
class  Guard
 
class  GuardAwaiter
 
class  GuardState
 
class  GuardStickyAwaiter
 
struct  Head
 
struct  Head< T, Args... >
 
class  Helper
 
class  Injector
 
class  InlineCore
 
struct  InstantiationTypes
 
struct  InstantiationTypes< Instance, Instance< V, E > >
 
struct  Invoke
 
struct  Invoke< Func, void >
 
struct  IsInstantiationOf
 
struct  IsInstantiationOf< Instance, Instance< Args... > >
 
struct  IsInvocable
 
struct  IsInvocable< Func, void >
 
class  List
 
class  LockAwaiter
 
class  LockStickyAwaiter
 
struct  MultiEvent
 
class  Mutex
 
class  MutexEvent
 
struct  MutexImpl
 
struct  Node
 Node class, used in intrusive data structure. More...
 
struct  NopeBase
 
struct  NopeDeleter
 
class  NoResultCore
 
struct  NoTimeoutTag
 
class  OnAwaiter
 
struct  OneCounter
 
class  PromiseCore
 
class  PromiseType
 
struct  PromiseTypeDeleter
 
class  ReadyCore
 
class  RecursiveMutex
 
class  RecursiveTimedMutex
 
class  ResultCore
 
struct  Return
 
struct  Return< V, E, Func, 1 >
 
struct  Return< V, E, Func, 2 >
 
struct  Return< V, E, Func, 3 >
 
struct  Return< V, E, Func, 4 >
 
struct  Return< V, E, Func, 5 >
 
class  SafeCall
 
struct  SetDeleter
 
class  SharedFunc
 
class  SharedMutex
 
struct  SharedMutexImpl
 
class  SharedTimedMutex
 
class  Spinlock
 
class  Stack
 
class  TimedMutex
 
struct  TransferAwaiter
 
struct  TransferSingleAwaiter
 
class  UniqueJob
 
class  UnlockAwaiter
 
class  UnlockOnAwaiter
 
class  UnlockStickyAwaiter
 
class  Yield
 

Typedefs

template<CoreType Type, typename V , typename E >
using ResultCoreT = std::conditional_t< Type==CoreType::Detach, NoResultCore, ResultCore< V, E > >
 
template<typename V , typename E >
using ResultCorePtr = IntrusivePtr< ResultCore< V, E > >
 
template<bool Single>
using AwaitOnCounterT = std::conditional_t< Single, OneCounter< NopeBase, NopeDeleter >, AtomicCounter< NopeBase, NopeDeleter > >
 
using DefaultEvent = MutexEvent
 

Enumerations

enum class  CoreType : unsigned char { Run = 0 , Then = 1 , Detach = 2 }
 
enum class  CallbackType : unsigned char {
  Inline = 0 , On = 1 , InlineOn = 2 , LazyInline = 3 ,
  LazyOn = 4
}
 
enum  WaitStatus { Timeout , Ready }
 
enum class  LogLevel : unsigned char { Debug = 0 , Warn = 1 , Count = 3 }
 

Functions

YACLIB_INLINE void Loop (InlineCore *prev, InlineCore *curr) noexcept
 
InlineCoreMakeDrop () noexcept
 
YACLIB_INLINE BaseCoreMoveToCaller (BaseCore *head) noexcept
 
template<typename V , typename E , typename Func >
constexpr char Tag () noexcept
 
template<CoreType CoreT, bool kIsCall, typename Arg , typename E , typename Func >
autoMakeCore (Func &&f)
 
template<CoreType CoreT, CallbackType CallbackT, typename Arg , typename E , typename Func >
auto SetCallback (ResultCorePtr< Arg, E > &core, IExecutor *executor, Func &&f)
 
template<bool SymmetricTransfer>
YACLIB_INLINE auto Step (InlineCore &caller, InlineCore &callback) noexcept
 
template<bool SymmetricTransfer>
YACLIB_INLINE auto Noop () noexcept
 
template<typename Event , typename Timeout , typename Range >
bool WaitRange (const Timeout &timeout, Range &&range, std::size_t count) noexcept
 
template<typename Event , typename Timeout , typename... Cores>
bool WaitCore (const Timeout &timeout, Cores &... cores) noexcept
 
template<typename Event , typename Timeout , typename Iterator >
bool WaitIterator (const Timeout &timeout, Iterator it, std::size_t count) noexcept
 
template bool WaitCore< DefaultEvent, NoTimeoutTag, BaseCore > (const NoTimeoutTag &, BaseCore &) noexcept
 
template bool WaitCore< DefaultEvent, NoTimeoutTag, BaseCore, BaseCore > (const NoTimeoutTag &, BaseCore &, BaseCore &) noexcept
 
template<typename Combinator , typename It >
void WhenImpl (Combinator *combinator, It it, std::size_t count) noexcept
 
template<typename Combinator , typename E , typename... V>
void WhenImpl (Combinator &combinator, FutureBase< V, E > &&... fs) noexcept
 
template<bool SymmetricTransfer>
auto WhenSetResult (BaseCore *callback)
 
template<typename V = Unit, typename E = StopError, typename Func >
YACLIB_INLINE auto Run (IExecutor &e, Func &&f)
 
template<typename Func >
JobMakeUniqueJob (Func &&f)
 
bool ShouldFailAtomicWeak ()
 
void SetAtomicWeakFailFrequency (std::uint32_t k)
 
constexpr std::cv_status CVStatusFrom (WaitStatus)
 
constexpr std::cv_status CVStatusFrom (std::cv_status)
 
template<typename V , typename E , typename Func >
YACLIB_INLINE auto Schedule (IExecutor &e, Func &&f)
 
void Start (BaseCore *head, IExecutor &e) noexcept
 
void Start (BaseCore *head) noexcept
 
void SetCallback (LogLevel level, LogCallback callback) noexcept
 
void LogMessage (LogLevel level, std::string_view file, std::size_t line, std::string_view func, std::string_view condition, std::string_view message) noexcept
 
void SetSeed (std::uint32_t new_seed)
 
std::uint32_t GetSeed ()
 
std::uint64_t GetRandNumber (std::uint64_t max)
 
std::uint64_t GetRandCount ()
 
void ForwardToRandCount (std::uint64_t random_count)
 

Variables

static std::uint32_t sAtomicFailFrequency = 13
 
static std::uint32_t sYieldFrequency = 16
 
static std::uint32_t sSleepTime = 100
 
static std::uint64_t sInjectedCount = 0
 
static std::uint32_t sSeed = 1239
 
static thread_local std::mt19937_64 eng {sSeed}
 
static std::array< LogCallback, static_cast< std::size_t >(LogLevel::Count)> sCallbacks = {}
 

Typedef Documentation

◆ AwaitOnCounterT

◆ DefaultEvent

◆ ResultCorePtr

◆ ResultCoreT

template<CoreType Type, typename V , typename E >
using yaclib::detail::ResultCoreT = typedef std::conditional_t<Type == CoreType::Detach, NoResultCore, ResultCore<V, E> >

Definition at line 34 of file core.hpp.

Enumeration Type Documentation

◆ CallbackType

Enumerator
Inline 
On 
InlineOn 
LazyInline 
LazyOn 

Definition at line 295 of file core.hpp.

◆ CoreType

Enumerator
Run 
Then 
Detach 

Definition at line 27 of file core.hpp.

◆ LogLevel

Enumerator
Debug 
Warn 
Count 

Definition at line 14 of file log.hpp.

◆ WaitStatus

Enumerator
Timeout 
Ready 

Definition at line 5 of file wait_status.hpp.

Function Documentation

◆ CVStatusFrom() [1/2]

constexpr std::cv_status yaclib::detail::CVStatusFrom ( std::cv_status  status)
constexpr

Definition at line 12 of file condition_variable.cpp.

References yaclib::MakeContract().

◆ CVStatusFrom() [2/2]

constexpr std::cv_status yaclib::detail::CVStatusFrom ( WaitStatus  status)
constexpr

◆ ForwardToRandCount()

void yaclib::detail::ForwardToRandCount ( std::uint64_t  random_count)

Definition at line 37 of file util.cpp.

References GetRandNumber(), and yaclib::MakeContract().

Referenced by yaclib::fiber::ForwardToFaultRandomCount().

◆ GetRandCount()

std::uint64_t yaclib::detail::GetRandCount ( )

Definition at line 29 of file util.cpp.

References yaclib::MakeContract().

Referenced by yaclib::fiber::GetFaultRandomCount().

◆ GetRandNumber()

◆ GetSeed()

std::uint32_t yaclib::detail::GetSeed ( )

Definition at line 18 of file util.cpp.

References sSeed.

Referenced by yaclib::detail::thread::RandomDevice::reset().

◆ LogMessage()

void yaclib::detail::LogMessage ( LogLevel  level,
std::string_view  file,
std::size_t  line,
std::string_view  func,
std::string_view  condition,
std::string_view  message 
)
noexcept

Definition at line 10 of file log.cpp.

References yaclib::MakeContract(), and sCallbacks.

◆ Loop()

◆ MakeCore()

template<CoreType CoreT, bool kIsCall, typename Arg , typename E , typename Func >
auto * yaclib::detail::MakeCore ( Func &&  f)

Definition at line 281 of file core.hpp.

References Detach, yaclib::MakeContract(), and Run.

◆ MakeDrop()

InlineCore & yaclib::detail::MakeDrop ( )
noexcept

◆ MakeUniqueJob()

template<typename Func >
Job * yaclib::detail::MakeUniqueJob ( Func &&  f)

Definition at line 32 of file unique_job.hpp.

References yaclib::MakeContract().

Referenced by yaclib::Submit().

◆ MoveToCaller()

◆ Noop()

template<bool SymmetricTransfer>
YACLIB_INLINE auto yaclib::detail::Noop ( )
noexcept

Definition at line 35 of file inline_core.hpp.

References yaclib::MakeContract(), and yaclib_std::noop_coroutine().

◆ Run()

template<typename V = Unit, typename E = StopError, typename Func >
YACLIB_INLINE auto yaclib::detail::Run ( IExecutor e,
Func &&  f 
)

Definition at line 14 of file run.hpp.

References yaclib::MakeContract().

◆ Schedule()

template<typename V , typename E , typename Func >
YACLIB_INLINE auto yaclib::detail::Schedule ( IExecutor e,
Func &&  f 
)

Definition at line 9 of file schedule.hpp.

References yaclib::MakeContract().

◆ SetAtomicWeakFailFrequency()

void yaclib::detail::SetAtomicWeakFailFrequency ( std::uint32_t  k)

Definition at line 16 of file atomic.cpp.

References yaclib::MakeContract(), and sAtomicFailFrequency.

Referenced by yaclib::SetAtomicFailFrequency().

◆ SetCallback() [1/2]

void yaclib::detail::SetCallback ( LogLevel  level,
LogCallback  callback 
)
noexcept

Definition at line 17 of file log.cpp.

References yaclib::MakeContract(), and sCallbacks.

◆ SetCallback() [2/2]

◆ SetSeed()

void yaclib::detail::SetSeed ( std::uint32_t  new_seed)

Definition at line 13 of file util.cpp.

References eng, yaclib::MakeContract(), and sSeed.

Referenced by yaclib::SetSeed().

◆ ShouldFailAtomicWeak()

◆ Start() [1/2]

void yaclib::detail::Start ( BaseCore head)
noexcept

Definition at line 12 of file task_impl.cpp.

References yaclib::MakeContract(), and MoveToCaller().

◆ Start() [2/2]

void yaclib::detail::Start ( BaseCore head,
IExecutor e 
)
noexcept

◆ Step()

template<bool SymmetricTransfer>
YACLIB_INLINE auto yaclib::detail::Step ( InlineCore caller,
InlineCore callback 
)
noexcept

Definition at line 23 of file inline_core.hpp.

References yaclib::MakeContract().

◆ Tag()

template<typename V , typename E , typename Func >
constexpr char yaclib::detail::Tag ( )
constexprnoexcept

Definition at line 236 of file core.hpp.

References yaclib::MakeContract().

◆ WaitCore()

template<typename Event , typename Timeout , typename... Cores>
bool yaclib::detail::WaitCore ( const Timeout timeout,
Cores &...  cores 
)
noexcept

Definition at line 50 of file wait_impl.hpp.

References yaclib::MakeContract().

◆ WaitCore< DefaultEvent, NoTimeoutTag, BaseCore >()

◆ WaitCore< DefaultEvent, NoTimeoutTag, BaseCore, BaseCore >()

◆ WaitIterator()

bool yaclib::detail::WaitIterator ( const Timeout timeout,
Iterator  it,
std::size_t  count 
)
noexcept

Definition at line 62 of file wait_impl.hpp.

References yaclib::MakeContract(), and YACLIB_ASSERT.

◆ WaitRange()

bool yaclib::detail::WaitRange ( const Timeout timeout,
Range &&  range,
std::size_t  count 
)
noexcept

Definition at line 20 of file wait_impl.hpp.

References yaclib::MakeContract().

◆ WhenImpl() [1/2]

template<typename Combinator , typename E , typename... V>
void yaclib::detail::WhenImpl ( Combinator combinator,
FutureBase< V, E > &&...  fs 
)
noexcept

Definition at line 22 of file when_impl.hpp.

References yaclib::MakeContract(), and YACLIB_ASSERT.

◆ WhenImpl() [2/2]

void yaclib::detail::WhenImpl ( Combinator combinator,
It  it,
std::size_t  count 
)
noexcept

◆ WhenSetResult()

template<bool SymmetricTransfer>
auto yaclib::detail::WhenSetResult ( BaseCore callback)

Definition at line 29 of file when_impl.hpp.

References Loop(), and yaclib::MakeContract().

Variable Documentation

◆ eng

thread_local std::mt19937_64 yaclib::detail::eng {sSeed}
static

Definition at line 11 of file util.cpp.

Referenced by GetRandNumber(), and SetSeed().

◆ sAtomicFailFrequency

std::uint32_t yaclib::detail::sAtomicFailFrequency = 13
static

Definition at line 9 of file atomic.cpp.

Referenced by SetAtomicWeakFailFrequency(), and ShouldFailAtomicWeak().

◆ sCallbacks

std::array<LogCallback, static_cast<std::size_t>(LogLevel::Count)> yaclib::detail::sCallbacks = {}
static

Definition at line 8 of file log.cpp.

Referenced by LogMessage(), and SetCallback().

◆ sInjectedCount

std::uint64_t yaclib::detail::sInjectedCount = 0
static

◆ sSeed

std::uint32_t yaclib::detail::sSeed = 1239
static

Definition at line 5 of file util.cpp.

Referenced by GetSeed(), and SetSeed().

◆ sSleepTime

std::uint32_t yaclib::detail::sSleepTime = 100
static

◆ sYieldFrequency

std::uint32_t yaclib::detail::sYieldFrequency = 16
static

Definition at line 9 of file injector.cpp.

Referenced by yaclib::detail::Injector::SetFrequency().