因此,最后两个读线程都等待条件变量,互斥锁没有被锁住。
Therefore, at the end of it all, you now have two reader threads, both waiting on the condition variable, and the mutex is unlocked.
一旦计数器达到界限就激活的线程会等待条件变量。
The thread that activates once the counter reaches the limit would wait on the condition variable.
这些同步类提供了一种在等待条件变为真时不消耗CPU的途径。
The concurrent classes provide a way to consume no CPU while waiting for a condition to be true.
这么做会唤醒所有等待条件变量_ cond的读线程;读线程现在隐式地争夺互斥锁。
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.
接下来,读线程需要确保(这是第二个检查)它等待条件变量的时间不超过指定的超时时间。
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.
它还允许您原子地(atomically)解除互斥的锁定,并等待条件变量,而不会有干涉其他线程的可能。
It also allows you to unlock the mutex and wait on the condition variable atomically, without the possible intervention of another thread.
对互斥对象解锁会立即发生,但等待条件mycond通常是一个阻塞操作,这意味着线程将睡眠,在它苏醒之前不会消耗CPU周期。
Unlocking the mutex happens immediately, but waiting on the condition mycond is normally a blocking operation, meaning that our thread will go to sleep, consuming no CPU cycles until it is woken up.
如果这些条件不都满足,或者第二条指令在执行之前需要等待依赖项,那么它们可以在单独的周期中执行。
If these conditions are not all met, or if the second instruction needs to wait for dependencies before issuing, then they are issued in separate cycles.
在机场等待是件不愉快的事,但他很快得出结论:今天的雪意味着明天更好的滑雪条件。
Waiting at the airport is not pleasant, but he quickly concludes that snow today means better skiing conditions tomorrow.
边界条件将等待未测试的、范围之外数据,允许它们将您的应用程序带到其管辖范围之内。
The boundary conditions wait, untested, for out-of-domain data that will permit them to bring your application to its metaphorical knees.
真正需要的是这样一种方法,当线程在等待满足某些条件时使线程进入睡眠状态。
What you really need is a way to put a thread to sleep while it waits for some condition to be met.
适时达到这些条件,然后等待。
那么如果我们等待和平谈判的条件成熟,我们将等待很长的时间,同时也就给各处的激进份子有可乘之机。
Well, if we wait for the conditions to be ripe to talk peace, we will be waiting a long time, and in the meantime we will be giving the initiative to extremists, everywhere.
如果符合条件的消息不存在,操作并不会等待消息的出现。它只是简单地用一个新的刷新间隔周期来组装一个刷新响应并将它返回给调用者。
If no message exists, the operation does not wait around for one; it simply prepares another refresh Response with a new refresh interval period and returns that back to the caller.
它将在条件满足时停止等待,或者在超出最大等待时间时返回一个超时异常。
It will stop waiting if the condition is fulfilled, or return a timeout exception if it exceeds the maximum waiting time.
这个操作要消耗一定的时间,实际上,这个时间太长了,可能在进行这项操作的同时,线程所等待的条件变量的值在这期间已经改变了。
This may take some time. In fact, it may take so much time that the condition you were waiting for is no longer the case.
酿酒人员观察并等待着这两个规定条件同时具备,然后就……开始采摘。
Winemakers watch and wait until these two defining moments line up, and then... let the harvest begin.
设备代理可以在轮流检测的间隔或设备启动后的任何时刻(或两种条件同时满足)查询等待执行的作业,这依赖于所处的环境。
Depending on the environment, the device agent may poll for waiting jobs at a polling interval, or whenever the device is powered on, or both.
如果线程正在等待某个特定条件发生,它应该如何处理这种情况?
I ended my previous article by describing a particular dilemma: how does a thread deal with a situation where it is waiting for a specific condition to become true?
一旦条件满足,还需要一种方法以唤醒因等待满足特定条件而睡眠的线程。
Once the condition is met you need a method to wake up the thread (s) that are waiting for that particular condition to become true.
一旦Selenium检测到条件返回为真,它将停止等待。
Once Selenium detects that the condition returns true, it will stop waiting.
如果队列满了,写线程等待_ wcond条件变量;读线程在从队列中取出数据之后需要通知所有线程。
If the queue is full, the writer thread waits on the _wcond condition variable; the reader thread will need a notification to all threads after consuming data from the queue.
push方法不依赖于任何条件变量,所以没有额外的等待。
Now, the push method doesn't depend on any condition variables, so no extra waiting there.
因此,意图提供对CPU资源的公平访问(等待某个条件变为真)的编码模式实际上将消耗运行它的整个CPU核心。
So a coding pattern intended to provide fair access to CPU resources while waiting for a condition to become true in fact consumes 100 percent of whichever CPU core it happens to start running on.
McKechnie说,有些人的居住条件“很差”,他们已经开始耐心地等待新居。
Some, McKechnie says are living in "quite bad" conditions and were now getting impatient waiting for new homes.
解决这个问题的最佳方法是使用pthread_cond_wait调用来等待特殊条件发生。
The best way to do this is to use the pthread_cond_wait call to wait on a particular condition to become true.
我们在第2部分的讨论中已经知道,Task2将等待此单个输入条件的所有输入。
As we already know from our discussion in Section 2, Task 2 will wait for all inputs in this single input criterion.
如果另一个线程对一个条件变量调用pthread_cond_signal,那么那个等待这个条件而被阻塞的线程就会被唤醒。
If another thread calls pthread_cond_signal on a condition, then a thread that was waiting on that condition variable is woken up.
加州马利布市招生公司VeritasPrep的MBA招生研究负责人施勒姆(ScottShrum)建议,在等待最后结果的时候,要想方设法地让自己的申请条件更加有优势。
Scott Shrum, director of M.B.A. admissions research of Veritas Prep, an admissions firm in Malibu, Calif., suggests finding ways to make your candidacy even stronger while waiting for a final answer.
当活动收到至少一个输入条件的所有必需输入后,便可以执行该活动,否则它将等待这些输入到来。
An activity can execute if it receives all required inputs of at least one input criterion, otherwise it waits for these inputs to arrive.
应用推荐