Waiting
From cxwiki
There are a number of possilbe ways to wait for something to happen. Which to use is very dependant on your specific circumstances.
A number of alternatives are listed here.
// Sleep is for preemptive threads to give time to other threads
static void CXThread::Sleep(uint32 msec);
static void CXThread::NanoSleep(uint64 nsec);
// wait for this condition to be signalled; or for the timeout to occur
void CXCondition::WaitForCondition(const CXTimeVal& timeout) const;
bool CXEvent::WaitOnEvent(const CXTimeVal& timeout) const; // absolute time to end waiting
static void CXGenericEvent::WaitOnEvent(const CXGenericEventRef& event);
static size_t CXGenericEvent::WaitOnAnyEvent(const std::vector<CXGenericEventRef>& events);
static bool CXFiber::Sleep(void);
static bool CXFiber::Sleep(uint minimumDelayMs);
static bool CXFiber::WaitOnEvent(const CXEvent& event, CXTimeVal* __nullable optionalWakeTime = nullptr);
void CXTimer::AddTimer(uint32 timerID, void* data, uint32 deltaTimeMs, uint32 flags);
void CXWorkerHost::WaitOnTasks(const void* workerCookie, const cx_function<bool(void)>& idleFunction = cx_function<bool(void)>());
void CXWorkerChain::WaitOnTasks(void) const;