Like many queue algorithms, an empty queue consists of a single dummy node.
像许多队列算法一样,空队列只包含一个假节点。
If there is a slight skewing favoring an empty queue over a full one, the pipe will rarely fill and the reader will more often receive fresh Numbers.
如果有轻微的扭曲支持一个空的队列满的,管道将很少填补和读者经常会收到新的号码。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
应用推荐