Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
#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. | |
Wait until woken up or a time-out occured.
mutex | Mutex to unlock while waiting. |
maxTime | Maximum 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().