| 1 | #include "pthread_impl.h" |
| 2 | |
| 3 | int __pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict m, const struct timespec *restrict ts) |
| 4 | { |
| 5 | 	/* Error check mutexes must detect if they're not locked (UB for others) */ |
| 6 | 	if (!m->_m_count) return EPERM; |
| 7 | 	int ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, ts, 0); |
| 8 | 	if (ret == 0) return ETIMEDOUT; |
| 9 | 	if (ret != EINTR) return ret; |
| 10 | 	return 0; |
| 11 | } |
| 12 | |
| 13 | weak_alias(__pthread_cond_timedwait, pthread_cond_timedwait); |