Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
Public Member Functions | List of all members
CCond Class Reference

Description

Class to wrap (POSIX) condition variables.

Definition at line 1740 of file base.H.

#include "base.H"

Public Member Functions

void Wait (CMutex *mutex)
 Wait until woken up. The supplied mutex must be locked and will be atomically unlocked while waiting.
 
TTicks Wait (CMutex *mutex, TTicks maxTime)
 Wait until woken up or a time-out occured. More...
 
void Signal ()
 Wakeup ONE waiting thread.
 
void Broadcast ()
 Wakeup ALL waiting threads.
 

Member Function Documentation

◆ Wait()

TTicks CCond::Wait ( CMutex mutex,
TTicks  maxTime 
)

Wait until woken up or a time-out occured.

Parameters
mutexMutex to unlock while waiting.
maxTimeMaximum wait time in milliseconds.

If woken up by signalling or by a spurious wakeup (see POSIX specification), the time left to wait is returned. If the maximum time has passed, -1 is returned.

Please note, that unlike the POSIX recommendations, the time-out is not specified as an absolute time here, but as a time relative from "now". This is more convenient, but care has to be taken when calling this method multiple times to wait for a certain total time. To be accurate in total, the remaining time for the repeateds invocation should not be taken from the return value, but recomputed according to the current time (to be determined by TicksNow().


The documentation for this class was generated from the following file: