/* Sleep on thread wakeup address */ int _thr_sleep(struct pthread *curthread, int clockid, const struct timespec *abstime) { if (curthread->wake_addr->value != 0) return (0); return _thr_umtx_timedwait_uint(&curthread->wake_addr->value, 0, clockid, abstime, 0); }
/* Sleep on thread wakeup address */ int _thr_sleep(struct pthread *curthread, int clockid, const struct timespec *abstime) { curthread->will_sleep = 0; if (curthread->nwaiter_defer > 0) { _thr_wake_all(curthread->defer_waiters, curthread->nwaiter_defer); curthread->nwaiter_defer = 0; } if (curthread->wake_addr->value != 0) return (0); return _thr_umtx_timedwait_uint(&curthread->wake_addr->value, 0, clockid, abstime, 0); }