/** \brief Wait for the condition * * \b os_condWait calls \b pthread_cond_wait to wait * for the condition. */ os_result os_condWait ( os_cond *cond, os_mutex *mutex) { return condTimedWait(cond, mutex, INFINITE); }
/** \brief Wait for the condition * * \b os_condWait calls \b pthread_cond_wait to wait * for the condition. */ void os_condWait ( os_cond *cond, os_mutex *mutex) { (void) condTimedWait(cond, mutex, INFINITE); }
/** \brief Wait for the condition but return when the specified * time has expired before the condition is triggered * * \b os_condTimedWait calls \b pthread_cond_timedwait to * wait for the condition with a timeout. * * \b os_condTimedWait provides an relative time to wait while * \b pthread_cond_timedwait expects an absolute time to wakeup. * The absolute time is calculated from the current time + the * provided relative time. * * \b os_condTimedWait will repeat \b pthread_cond_timedwait in case of an * interrupted system call. Because the time which is passed onto * \b pthread_cond_timedwait is absolute, no remaining time must be * calculated. */ os_result os_condTimedWait ( os_cond *cond, os_mutex *mutex, const os_time *time) { DWORD wait_time; assert (cond != NULL); assert (mutex != NULL); assert (time != NULL); wait_time = time->tv_sec * 1000 + time->tv_nsec / 1000000; return condTimedWait(cond, mutex, wait_time); }
/** \brief Wait for the condition but return when the specified * time has expired before the condition is triggered * * \b os_condTimedWait calls \b pthread_cond_timedwait to * wait for the condition with a timeout. * * \b os_condTimedWait provides an relative time to wait while * \b pthread_cond_timedwait expects an absolute time to wakeup. * The absolute time is calculated from the current time + the * provided relative time. * * \b os_condTimedWait will repeat \b pthread_cond_timedwait in case of an * interrupted system call. Because the time which is passed onto * \b pthread_cond_timedwait is absolute, no remaining time must be * calculated. */ os_result os_condTimedWait ( os_cond *cond, os_mutex *mutex, os_duration timeout) { DWORD wait_time; assert (cond != NULL); assert (mutex != NULL); assert (OS_DURATION_ISPOSITIVE(timeout)); if (timeout < 0) { wait_time = 0; } else { wait_time = (DWORD)(timeout/1000000); } return condTimedWait(cond, mutex, wait_time); }