Queue.Xt
Explicit transaction log passing on queues.
swap q1 q2
exchanges the contents of the queues q1
and q2
.
to_seq s
returns a concurrency and parallelism safe sequence for iterating through the elements of the queue front to back.
The sequence is based on a constant time, O(1)
, snapshot of the queue and modifications of the queue have no effect on the sequence.
add x q
adds the element x
at the end of the queue q
.
peek_opt q
returns the first element in queue q
, without removing it from the queue, or returns None
if the queue is empty.
peek_blocking q
returns the first element in queue q
, without removing it from the queue, or blocks waiting for the queue to become non-empty.
take_blocking q
removes and returns the first element in queue q
, or blocks waiting for the queue to become non-empty.
take_opt q
removes and returns the first element in queue q
, or returns None
if the queue is empty.