================スレッド1
pthread_mutex_lock(&mutex);
do
{
fun();//this fun will cost a long time, maybe 1-2 second
gettimeofday(&now, NULL);
outtime.tv_sec = now.tv_sec + 5;
outtime.tv_nsec = now.tv_usec * 1000;
int ret = pthread_cond_timedwait(&cond, &mutex, &outtime);
} while((!predicate && ret != ETIMEDOUT)
pthread_mutex_unlock(&mutex);
==========================スレッド2
pthread_mutex_lock(&mutex);
predicate = true;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
スレッド 2 がスレッド 1 の fun() 中にシグナルを送信した場合、pthread_cond_timedwait はありません。fun() 呼び出しが戻ると、スレッド 1 の phread_cond_timedwait は、スレッド 2 が前に送信したシグナルを取得できますか? while() で pthread_cond_timedwait の前に時間のかかる fun を呼び出すことはできますか??