24#ifndef RIOT_CONDITION_VARIABLE_HPP
25#define RIOT_CONDITION_VARIABLE_HPP
82 template <class Predicate>
106 template <class Predicate>
117 template <class Rep, class Period>
119 const std::chrono::duration<Rep, Period>& rel_time);
129 template <class Rep, class Period, class Predicate>
131 const std::chrono::duration<Rep, Period>& rel_time,
146template <
class Predicate>
153template <
class Predicate>
158 if (
wait_until(lock, timeout_time) == cv_status::timeout) {
165template <
class Rep,
class Period>
167 const std::chrono::duration
168 <Rep, Period>& timeout_duration) {
169 using namespace std::chrono;
170 using std::chrono::duration;
171 if (timeout_duration <= timeout_duration.zero()) {
172 return cv_status::timeout;
174 uint64_t timeout, before, after;
175 timeout = (duration_cast<microseconds>(timeout_duration)).count();
182 if (after - before >= timeout) {
183 return cv_status::timeout;
185 return cv_status::no_timeout;
188template <
class Rep,
class Period,
class Predicate>
190 const std::chrono::duration
191 <Rep, Period>& timeout_duration,
193 return wait_until(lock, std::chrono::steady_clock::now() + timeout_duration,
C++11 chrono drop in replacement that adds the function now based on ztimer/timex.
C++11 compliant implementation of condition variable, uses the time point implemented in our chrono r...
void wait(unique_lock< mutex > &lock) noexcept
Block until woken up through the condition variable.
cv_status wait_for(unique_lock< mutex > &lock, const std::chrono::duration< Rep, Period > &rel_time)
Blocks until woken up through the condition variable or when the thread has been blocked for a certai...
void notify_one() noexcept
Notify one thread waiting on this condition.
void notify_all() noexcept
Notify all threads waiting on this condition variable.
native_handle_type native_handle()
Returns the native handle of the condition variable.
cv_status wait_until(unique_lock< mutex > &lock, const time_point &timeout_time)
Block until woken up through the condition variable or a specified point in time is reached.
C++11 compliant implementation of mutex, uses the time point implemented in our chrono replacement in...
A time point for timed wait, as clocks from the standard are not available on RIOT.
C++11 compliant implementation of unique lock.
static kernel_pid_t thread_getpid(void)
Returns the process ID of the currently running thread.
static void ztimer64_set_wakeup(ztimer64_clock_t *clock, ztimer64_t *timer, uint64_t offset, kernel_pid_t pid)
Set a timer that wakes up a thread (relative version)
void ztimer64_remove(ztimer64_clock_t *clock, ztimer64_t *timer)
Remove a timer from a clock.
uint64_t ztimer64_now(ztimer64_clock_t *clock)
Get the current time from a clock.
ztimer64_clock_t *const ZTIMER64_USEC
Default ztimer microsecond clock.
C++11 mutex drop in replacement.
cv_status
Status for timeout-based calls of the condition variable.
Scheduler API definition.
data type for priority queues
priority_queue_node_t * first
first queue node