像许多队列算法一样,空队列只包含一个假节点。
Like many queue algorithms, an empty queue consists of a single dummy node.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
线程调度程序必须从非空的最高优先级队列的头部开始调度。
The thread scheduler must dispatch from the head of the highest-priority queue that is not empty.
当线程的任务队列为空,它将尝试从另一个线程的deque的尾部窃取另一个任务。
In the event the thread's task queue is empty, it then tries to steal another task off the tail of another thread's deque.
第一个读线程锁住互斥锁,发现队列是空的,然后在 _cond 上阻塞自身,这会隐式地释放互斥锁。
The first reader thread locked the mutex, realized that the queue is empty, and blocked itself on _cond, which implicitly released the mutex.
当队列为空时,这两个指针指向同一位置。
When the queue is empty, both of these pointers point to the same location.
提示:保持持有队列为空。
当队列为空时,您在其中放置了950条消息。
在从队列中删除一个任务之前,work方法进行检查以查看队列是否为空,如果为空则等待。
Before removing a task from the queue, the work method checks to see if it is empty and if so, waits.
队列是BlockingCollection,它非常适合这个模块:在队列满时,阻塞生产者线程,当队列空时,阻塞消费者线程。
The queue is BlockingCollection which perfectly suits the needs of this module: it blocks the producer thread if the queue is full and blocks the consumer thread when queue is empty.
不过在队列为空时,它就会从其它线程的队列中“窃取”一些元素。
However, if its queue is empty then it will steal items from another thread's queue.
它最简单的使用模式便是作为一个线程安全的队列,并且在队列为空时阻塞消费者。
In its simplest mode it ACTS as a thread-safe queue in which consumers are blocked while the queue is empty.
它最简单的使用模式便是作为一个线程安全的队列,并且在队列为空时阻塞消费者。
In its simplest mode it ACTS as a thread-safe queue in which consumers are blocked while the queue is empty.
应用推荐