One consumer gets the lock, works the task, and leaves the queue empty.
一个consumer获得锁,运行任务,并把队列清空。
Children clutching empty bowls form a queue.
抓着空碗的孩子们排成一队。
Instead of throwing an exception when the queue is empty, the reader thread now blocks itself on the condition variable.
当队列是空的时候,读线程现在并不抛出异常,而是在条件变量上阻塞自身。
应用推荐