8#include "Arp/System/Commons/Threading/Mutex.hpp"
9#include "Arp/System/Commons/Chrono/TimePoint.hpp"
11namespace Arp {
namespace System {
namespace Ve
13class ICondVariableService;
16namespace Arp {
namespace System {
namespace Commons {
namespace Threading
51 template<
class Predicate>
52 void Wait(
Mutex& mutex, Predicate predicate);
60 template<
class Predicate>
61 bool WaitFor(
Mutex& mutex,
unsigned long timeoutMs, Predicate predicate);
69 template<
class Predicate>
70 bool WaitUntil(
Mutex& mutex, TimePointClockSteady timePoint, Predicate predicate);
79 void WaitInternal(
Mutex& mutex);
80 bool WaitUntilInternal(
Mutex& mutex, TimePointClockSteady timePoint);
90 Arp::System::Ve::ICondVariableService *pCondVariableService;
95template<
class Predicate>
104template<
class Predicate>
110 return WaitUntil(mutex, timePoint, predicate);
113template<
class Predicate>
117 while ((!predicate()) && result)
119 result = WaitUntilInternal(mutex, timePoint);
Condition variables can be used to synchronize between multiple threads
Definition: ConditionVariable.hpp:26
void NotifyOne(void)
Unblocks at least one thread waiting on this condition variable.
~ConditionVariable(void)
Destructs this instance and frees all resources.
void NotifyAll(void)
Unblocks every thread waiting on this condition variable.
void Wait(Mutex &mutex, Predicate predicate)
Blocks the calling thread until NotifyOne or NotifyAll is invoked and the predicate is fullfilled
Definition: ConditionVariable.hpp:96
bool WaitFor(Mutex &mutex, unsigned long timeoutMs, Predicate predicate)
Like Wait but returns if the signal is not deliverd within a specified time
Definition: ConditionVariable.hpp:105
ConditionVariable(void)
Constructs an ConditionVariable instance.
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:114
Mutual exclusion object to prevent data from concurrent modifications.
Definition: Mutex.hpp:26
std::chrono::milliseconds Milliseconds
The Arp Milliseconds unit class.
Definition: TypeSystem.h:52
SteadyClock::time_point SteadyTimePoint
Represents the type of a monotonic clock timepoint.
Definition: TypeSystem.h:40
@ System
System components used by the System, Device, Plc or Io domains.
Namespace for time related classes
Definition: Clock.hpp:11
Root namespace for the PLCnext API