23#ifndef CONDITIONVARIABLE_H
24#define CONDITIONVARIABLE_H
28#include "rtos/mbed_rtos_types.h"
29#include "rtos/Mutex.h"
30#include "rtos/Semaphore.h"
31#include "rtos/Kernel.h"
33#include "platform/NonCopyable.h"
35#if MBED_CONF_RTOS_PRESENT || defined(DOXYGEN_ONLY)
236 template <
typename Predicate>
286 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono time_point, not an integer millisecond count. For example use `Kernel::Clock::now() + 5s` rather than `Kernel::get_ms_count() + 5000`.")
360 template <class Predicate>
361 bool wait_until(Kernel::Clock::time_point abs_time, Predicate pred)
364 if (
wait_until(abs_time) == cv_status::timeout) {
411 MBED_DEPRECATED_SINCE(
"mbed-os-6.0.0",
"Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`.")
453 cv_status
wait_for(Kernel::Clock::duration_u32 rel_time);
485 template <class Predicate>
486 bool wait_for(Kernel::Clock::duration rel_time, Predicate pred)
488 return wait_until(Kernel::Clock::now() + rel_time, std::move(pred));
528#if !defined(DOXYGEN_ONLY)
538 static void _add_wait_list(Waiter **wait_list, Waiter *waiter);
539 static void _remove_wait_list(Waiter **wait_list, Waiter *waiter);
Prevents generation of copy constructor and copy assignment operator in derived classes.
The ConditionVariable class is a synchronization primitive that allows threads to wait until a partic...
~ConditionVariable()
ConditionVariable destructor.
bool wait_for(uint32_t millisec)
Wait for a notification or timeout.
void wait(Predicate pred)
Wait for a predicate.
ConditionVariable(Mutex &mutex)
Create and initialize a ConditionVariable object.
void notify_one()
Notify one waiter on this condition variable that a condition changed.
void wait()
Wait for a notification.
void notify_all()
Notify all waiters on this condition variable that a condition changed.
bool wait_until(uint64_t millisec)
Wait for a notification until the specified time.
The Mutex class is used to synchronize the execution of threads.
The Semaphore class is used to manage and protect access to a set of shared resources.