对于阻塞队列,只有读线程需要在队列中没有数据时等待。
In a blocking queue, only the reader thread needs to wait when there is no data in the queue.
因此,最后两个读线程都等待条件变量,互斥锁没有被锁住。
Therefore, at the end of it all, you now have two reader threads, both waiting on the condition variable, and the mutex is unlocked.
因此,在唤醒读线程之后,要确认列表非空,然后再继续处理。
Hence, after waking up the reader thread, verify that the list is not empty, and then proceed.
应用推荐