inline bool WaitD(TMutex& lock, TInstant deadLine) throw () { if (deadLine == TInstant::Max()) { int ret = pthread_cond_wait(&Cond_, (pthread_mutex_t*)lock.Handle()); VERIFY(ret == 0, "pthread_cond_wait failed: %s", LastSystemErrorText(ret)); return true; } else { struct timespec spec; Zero(spec); spec.tv_sec = deadLine.Seconds(); spec.tv_nsec = deadLine.NanoSecondsOfSecond(); int ret = pthread_cond_timedwait(&Cond_, (pthread_mutex_t*)lock.Handle(), &spec); VERIFY(ret == 0 || ret == ETIMEDOUT, "pthread_cond_timedwait failed: %s", LastSystemErrorText(ret)); return ret == 0; } }
inline bool WaitD(TMutex& lock, TInstant deadLine) throw () { int ret; if (deadLine == TInstant::Max()) { ret = pthread_cond_wait(&Cond_, (pthread_mutex_t*)lock.Handle()); } else { struct timespec spec; Zero(spec); spec.tv_sec = deadLine.Seconds(); spec.tv_nsec = deadLine.NanoSecondsOfSecond(); ret = pthread_cond_timedwait(&Cond_, (pthread_mutex_t*)lock.Handle(), &spec); YASSERT(ret == 0 || ret == ETIMEDOUT); } return ret == 0; }