8#include "Arp/System/Commons/Threading/Mutex.hpp"
9#include "Arp/System/Commons/Chrono/TimePoint.hpp"
12namespace Arp::System::Ve
14class ICondVariableService;
52 template<
class Predicate>
53 void Wait(
Mutex& mutex, Predicate predicate);
61 template<
class Predicate>
70 template<
class Predicate>
71 bool WaitUntil(
Mutex& mutex, TimePointClockSteady timePoint, Predicate predicate);
80 void WaitInternal(
Mutex& mutex);
81 bool WaitUntilInternal(
Mutex& mutex, TimePointClockSteady timePoint);
84 static TimePointClockSteady RoundUpToMultipleOf(
const TimePointClockSteady& timePoint,
const ClockSteady::duration& intervalRounding);
85 static ClockSteady::duration RoundUpToMultipleOf(
const ClockSteady::duration& duration,
const ClockSteady::duration& intervalRounding);
86 static ClockSteady::duration RoundDownToMultipleOf(
const ClockSteady::duration& duration,
const Arp::uint64& intervalRounding);
96 Arp::System::Ve::ICondVariableService *pCondVariableService;
101template<
class Predicate>
110template<
class Predicate>
114 return WaitUntil(mutex, timePoint, predicate);
117template<
class Predicate>
121 while ((!predicate()) && result)
123 result = WaitUntilInternal(mutex, timePoint);
Condition variables can be used to synchronize between multiple threads
Definition: ConditionVariable.hpp:27
void NotifyOne(void)
Unblocks at least one thread waiting on this condition variable.
Definition: ConditionVariable.cpp:38
~ConditionVariable(void)
Destructs this instance and frees all resources.
Definition: ConditionVariable.cpp:25
void NotifyAll(void)
Unblocks every thread waiting on this condition variable.
Definition: ConditionVariable.cpp:43
bool WaitFor(Mutex &mutex, uint64 timeoutMs, Predicate predicate)
Like Wait but returns if the signal is not deliverd within a specified time
Definition: ConditionVariable.hpp:111
void Wait(Mutex &mutex, Predicate predicate)
Blocks the calling thread until NotifyOne or NotifyAll is invoked and the predicate is fullfilled
Definition: ConditionVariable.hpp:102
ConditionVariable(void)
Constructs an ConditionVariable instance.
Definition: ConditionVariable.cpp:14
bool WaitUntil(Mutex &mutex, TimePointClockSteady timePoint, Predicate predicate)
Like Wait but returns if the signal is not deliverd until a specified time point
Definition: ConditionVariable.hpp:118
Mutual exclusion object to prevent data from concurrent modifications.
Definition: Mutex.hpp:27
SteadyClock::time_point SteadyTimePoint
Represents the type of a monotonic clock time-point.
Definition: ChronoTypes.hpp:31
std::uint64_t uint64
The Arp unsigned integer type of 8 byte size.
Definition: PrimitiveTypes.hpp:37
Namespace for time related classes
Namespace for classes handling threads and synchronization