46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
-
+
|
bool
of_condition_timed_wait(of_condition_t *condition, of_mutex_t *mutex,
of_time_interval_t timeout)
{
struct timespec ts;
ts.tv_sec = (time_t)timeout;
ts.tv_nsec = (timeout - ts.tv_sec) * 1000000000;
ts.tv_nsec = (long)((timeout - ts.tv_sec) * 1000000000);
return (pthread_cond_timedwait(condition, mutex, &ts) == 0);
}
bool
of_condition_free(of_condition_t *condition)
{
return (pthread_cond_destroy(condition) == 0);
}
|