pthread_mutex_lock(&mutex);
pthread_cond_timedwait(&cond,&mutex,&timeout);
printf("OK\n");
pthread_mutex_unlock(&mutex);
}
请问各位:这段代码有问题吗,为什么得不到预期的效果,搞了一天了,郁闷死了。作者: yecheng_110 时间: 2009-10-21 22:43
你期望的结果是什么?
实际的结果又是什么呢?作者: yecheng_110 时间: 2009-10-21 22:44
The pthread_cond_timedwait() function shall be equivalent to
pthread_cond_wait(), except that an error is returned if the absolute
time specified by abstime passes (that is, system time equals or
exceeds abstime) before the condition cond is signaled or broadcasted,
or if the absolute time specified by abstime has already been passed at
the time of the call.