Legend:
Library
Module
Module type
Parameter
Class
Class type
A blocking queue of finite size.
This queue, while still using locks underneath (like the regular blocking queue) should be enough for usage under reasonable contention.
The bounded size is helpful whenever some form of backpressure is desirable: if the queue is used to communicate between producer(s) and consumer(s), the consumer(s) can limit the rate at which producer(s) send new work down their way. Whenever the queue is full, means that producer(s) will have to wait before pushing new work.
try_pop ~force_lock q tries to pop the first element, or returns None if no element is available or if it failed to acquire q.
parameterforce_lock
if true, use Mutex.lock (which can block under contention); if false, use Mutex.try_lock, which might return None even in presence of an element if there's contention.