The calls act as a warning to other threads to go to sleep and wait their turn for the mutex lock.
这两个函数调用的作用就是警告其它线程,要它们继续睡眠并等待轮到它们对互斥对象加锁。
While still holding the mutex lock, our thread will call pthread_cond_wait(&mycond,&mymutex).
锁定互斥对象时,线程将调用 pthread_cond_wait(&mycond,&mymutex)。
Doing so awakens all the reader threads that were waiting on the condition variable _cond; the reader threads now implicitly compete for the mutex lock as and when it is released.
这么做会唤醒所有等待条件变量_ cond的读线程;读线程现在隐式地争夺互斥锁。
应用推荐