see this program: when the pthread_cond_timedwait() in notify_f() return by timeout, the following notify pthread_cond_broadcast() can't awake the pthread_cond_wait () in wait_f(). if call the notify_f() in a child thread just like the commented, not call it in the main process, then it will run rightly. is this a bug? i wish to get help soon. /*****************************************************/ #include <iostream.h> #include <sys/time.h> #include <unistd.h> #include <pthread.h> pthread_cond_t cond=PTHREAD_COND_INITIALIZER; pthread_mutex_t mutex=PTHREAD_MUTEX_INITIALIZER; void* wait_f(void*); void* notify_f(void*); main() { pthread_t thread1, thread2; pthread_create(&thread1, NULL, &wait_f, NULL); // // run notify_f() in a child thread // //pthread_create(&thread2, NULL, ¬ify_f, NULL); // // run notify_f in the main process // notify_f(NULL); sleep(10); exit(0); } void* wait_f(void*) { pthread_mutex_lock(&mutex); cout<<"1-1 sleeping "<<endl; pthread_cond_wait(&cond, &mutex); cout<<"1-1 waked up "<<endl; pthread_mutex_unlock(&mutex); } void* notify_f(void*) { struct timeval now; struct timespec timeout; gettimeofday(&now, NULL); timeout.tv_sec = now.tv_sec + 3; timeout.tv_nsec = now.tv_usec * 1000; pthread_mutex_lock(&mutex); cout<<"2-1 sleeping "<<endl; pthread_cond_timedwait(&cond, &mutex, &timeout); cout<<"2-1 waked "<<endl; cout<<"2-2 notify "<<endl; pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); sleep(3); } /***********************************************************/