相反,如果大小有限的队列满了,那么offer方法会返回false,而不需要处理队列满的异常。
Instead, if a sized queue was full, the offer method returns false, not causing you to deal with exceptions when full.
队列是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.
一些队列有大小限制,因此如果想在一个满的队列中加入一个新项,多出的项就会被拒绝。
Some queues are restricted in size, so when you want to add a new item to a full queue, the additional item is rejected.
应用推荐