队列是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.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当线程的任务队列为空,它将尝试从另一个线程的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.
应用推荐