• In some implementations, threads may occasionally wake up without a signal sent to their condition variable.

    在有些实现中,线程可能偶尔在没有信号送到条件变量的情况下醒过来。

    youdao

  • Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.

    当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。

    youdao

  • If another thread calls pthread_cond_signal on a condition, then a thread that was waiting on that condition variable is woken up.

    如果另一个线程对一个条件变量调用pthread_cond_signal,那么那个等待这个条件而被阻塞的线程就会被唤醒。

    youdao

  • Therefore, at the end of it all, you now have two reader threads, both waiting on the condition variable, and the mutex is unlocked.

    因此,最后两个读线程都等待条件变量,互斥锁没有被锁住。

    youdao

  • When you're done with a condition variable, you can release any resources allocated during initialization with a call to pthread_cond_destroy .

    当不再使用条件变量时,应该调用pthread_cond_destroy释放它在初始化时分配的资源。

    youdao

  • The thread that activates once the counter reaches the limit would wait on the condition variable.

    一旦计数器达到界限就激活的线程会等待条件变量。

    youdao

  • An aspect of the mutex I haven't covered here is that many operating systems support the concept of a condition variable.

    互斥锁有个我没讲到的方面,很多操作系统支持条件变量的概念。

    youdao

  • To work around this omission, I use the POSIX condition variable emulations synchronization primitives, which are outlined in the series of articles.

    为解决此缺憾,我使用POSIX条件变量模拟同步原语,并在一系列文章中对此进行了概述。

    youdao

  • The function primarily used for this is pthread_cond_wait . It takes two arguments; the first is a pointer to a condition variable, and the second is a locked mutex.

    函数pthread_cond_wait主要就是用于阻塞线程的,它有两个参数;第一个是一个指向条件变量的指针,第二个是一个锁定了的互斥量。

    youdao

  • Next, the reader thread needs to ensure (and this is the second check you perform) that it does not wait on the condition variable any more than the specified timeout period.

    接下来,读线程需要确保(这是第二个检查)它等待条件变量的时间不超过指定的超时时间。

    youdao

  • 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的读线程;读线程现在隐式地争夺互斥锁。

    youdao

  • 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的读线程;读线程现在隐式地争夺互斥锁。

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定