The thread that activates once the counter reaches the limit would wait on the condition variable.
一旦计数器达到界限就激活的线程会等待条件变量。
A condition variable allows a task to wait on a synchronization primitive within a critical region.
一个条件变量允许任务等待一个同步原语,以进入临界区。
In some implementations, threads may occasionally wake up without a signal sent to their condition variable.
在有些实现中,线程可能偶尔在没有信号送到条件变量的情况下醒过来。
A condition variable enables developers to implement a condition in which a thread executes and then blocked.
条件变量让开发者能够实现一个条件,在这个条件下线程执行然后被阻塞。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
An aspect of the mutex I haven't covered here is that many operating systems support the concept of a condition variable.
互斥锁有个我没讲到的方面,很多操作系统支持条件变量的概念。
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,那么那个等待这个条件而被阻塞的线程就会被唤醒。
Therefore, at the end of it all, you now have two reader threads, both waiting on the condition variable, and the mutex is unlocked.
因此,最后两个读线程都等待条件变量,互斥锁没有被锁住。
It also allows you to unlock the mutex and wait on the condition variable atomically, without the possible intervention of another thread.
它还允许您原子地(atomically)解除互斥的锁定,并等待条件变量,而不会有干涉其他线程的可能。
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释放它在初始化时分配的资源。
To work around this omission, I use the POSIX condition variable emulations synchronization primitives, which are outlined in the series of articles.
为解决此缺憾,我使用POSIX条件变量模拟同步原语,并在一系列文章中对此进行了概述。
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主要就是用于阻塞线程的,它有两个参数;第一个是一个指向条件变量的指针,第二个是一个锁定了的互斥量。
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.
接下来,读线程需要确保(这是第二个检查)它等待条件变量的时间不超过指定的超时时间。
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.
如果队列满了,写线程等待_ wcond条件变量;读线程在从队列中取出数据之后需要通知所有线程。
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的读线程;读线程现在隐式地争夺互斥锁。
The Multi-work Condition Declivitous Impact Testing System was introduced which has variable impacting angle, rigidity, and length of stroke.
论述了多工况倾斜冲击试验系统,该系统具有可变的冲击角度,刚度和行程长度。
Most programming languages have something called an assert-a statement that stops the processing when a certain condition is met, such as an unexpected value in an important variable.
大多数语言都具有一项称为断言的特性,这是一种会在满足某项条件时停止处理的语句,例如重要变量中出现超出预料的值。
Alternatively, you can drop the variable, as in Listing 6, because the condition is so simple.
另外,您也可以不使用变量,如清单6中所示,因为条件很简单。
Since the expected value at the selected path in the filter condition is only decided during execution, it needs to be defined as a variable.
由于过滤条件中选定的路径上的预期值是在执行时才确定的,因此需要将它定义为一个变量。
Use the single equal sign to assign a value to a variable, unlike the double equal sign (==), as in the previous condition, which compare the values.
使用单等于号来向变量赋值,而不是像在前一个条件中那样使用双等于号 (==) 来比较值。
Then the option combination fragment's guard condition is checked to verify the balance is greater then the amount variable.
然后检验选择项组合碎片的约束条件,确认余额大于金额变量。
The typical solution to a race condition is to ensure that your program has exclusive rights to something while it's manipulating it, such as a file, device, object, or variable.
竞争条件的典型解决方案是,确保程序在使用某个资源(比如文件、设备、对象或者变量)时,拥有自己的专有权。
If another thread calls pthread_cond_broadcast on a condition, then all threads waiting on that variable are woken up.
如果另一个线程对这个条件变量调用pthread_cond_broadcast,那么所有等待这个条件而被阻塞的线程都会被唤醒。
Often, a condition is too complex for the select attribute, and you must define a variable as an RTF.
通常,条件对于select属性来说太复杂了,您必须将变量定义为rtf。
The variable association dialog is launched by clicking the value column of the condition row, and selecting Use a variable to return the value in the drop-down box.
通过单击条件行的value列,并在下拉框中选择useavariabletoreturnthe value,可以打开变量关联对话框。
The product ID (PID) for each sales entry is passed to the PID variable that was created in the filter condition of the product feed.
每个销售条目的产品ID (PID)被传递给PID变量,该变量是在产品提要的过滤条件中创建的。
The experiment shows that the HMM wavelet can make the effective diagnosis for various faults of rolling bearings operating under the condition of variable speed and load or unknown speed.
试验证明,小波- HMM可以在变转速变载荷工况下以及未知转速情况下对滚动轴承的各种故障有效地进行诊断。
Copy a delegate to a local variable before publishing to avoid concurrency race condition.
应用前将委托复制到局部变量,以避免并发冲突。
Copy a delegate to a local variable before publishing to avoid concurrency race condition.
使用前将委托复制到局部变量,以避免并发冲突。
Copy a delegate to a local variable before publishing to avoid concurrency race condition.
使用前将委托复制到局部变量,以避免并发冲突。
应用推荐