extern "C" int pthread_mutex_lock_timeout_np(pthread_mutex_t* mutex_interface, unsigned ms) { timespec ts; timespec_from_ms(ts, ms); timespec abs_timeout; absolute_timespec_from_timespec(abs_timeout, ts, CLOCK_MONOTONIC); int error = __pthread_mutex_lock_with_timeout(__get_internal_mutex(mutex_interface), false, &abs_timeout); if (error == ETIMEDOUT) { error = EBUSY; } return error; }
extern "C" int pthread_cond_timeout_np(pthread_cond_t* cond_interface, pthread_mutex_t* mutex, unsigned ms) { timespec ts; timespec_from_ms(ts, ms); return pthread_cond_timedwait_relative_np(cond_interface, mutex, &ts); }
int pthread_cond_timeout_np(pthread_cond_t* cond, pthread_mutex_t* mutex, unsigned ms) { struct timespec ts; timespec_from_ms(&ts, ms); return __pthread_cond_timedwait_relative(cond, mutex, &ts); }