Module CCBlockingQueue
Blocking Queue
This queue has a limited size. Pushing a value on the queue when it is full will block.
- since
 - 0.16
 
val create : int -> 'a tCreate a new queue of size
n. Usingn=max_intamounts to using an infinite queue (2^61 items is a lot to fit in memory); usingn=1amounts to using a box with 0 or 1 elements inside.- raises Invalid_argument
 if
n < 1.
val push : 'a t -> 'a -> unitpush q xpushesxintoq, blocking if the queue is full.
val take : 'a t -> 'aTake the first element, blocking if needed.
val push_list : 'a t -> 'a list -> unitPush items of the list, one by one.
val take_list : 'a t -> int -> 'a listtake_list n qtakesnelements out ofq.
val try_take : 'a t -> 'a optionTake the first element if the queue is not empty, return
Noneotherwise.
val try_push : 'a t -> 'a -> booltry_push q xpushesxintoqifqis not full, in which case it returnstrue. If it fails becauseqis full, it returnsfalse.
val peek : 'a t -> 'a optionpeek qreturnsSome xifxis the first element ofq, otherwise it returnsNone.
val size : _ t -> intNumber of elements currently in the queue.
val capacity : _ t -> intNumber of values the queue can hold.