Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Moonpool.Bounded_queueSourceA 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.
A bounded queue.
push q x pushes x at the end of the queue. If q is full, this will block until there is room for x.
try_push q x attempts to push x into q, but abandons if it cannot acquire q or if q is full.
pop q pops the first element off q. It blocks if q is empty, until some element becomes available.
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.
transfer bq q2 transfers all elements currently available in bq into local queue q2, and clears bq, atomically. It blocks if bq is empty.
See Bb_queue.transfer for more details.
to_iter q returns an iterator over all items in the queue. This might not terminate if q is never closed.