bool condition::wait(mutex &mut, int msec) { bool ret; struct timeval now; struct timespec t; // mili/micro/nano/pico gettimeofday(&now, 0); t.tv_sec = now.tv_sec + msec/1000; t.tv_nsec = now.tv_usec * 1000 + msec%1000 * 1000000; if (t.tv_nsec > 1000000000) { t.tv_sec += 1; t.tv_nsec -= 1000000000; } ret = ETIMEDOUT == pthread_cond_timedwait(&dm_con, mut.get_os_mutex(), &t); return ret; }
bool condition::wait(mutex &mut, int msec) { return !dm_con.wait(mut.get_os_mutex(), msec); }
void condition::wait(mutex &mut) { dm_con.wait(mut.get_os_mutex()); }
void condition::wait(mutex &mut) { pthread_cond_wait(&dm_con, mut.get_os_mutex()); }