package devkit

  1. Overview
  2. Docs

Queue shared between multiple threads

type 'a t
val create : unit -> 'a t

Create queue

val put : 'a t -> 'a -> unit

Put item into the queue and return immediately

val get : 'a t -> 'a

Get item from the queue (will block while queue is empty)

val peek : 'a t -> 'a

Peek the item (leaving it in the queue)

val junk : 'a t -> unit

Drop item from the queue if present

val try_get : 'a t -> 'a option

Get item from the queue without blocking

  • returns

    None immediately if queue is empty

val length : 'a t -> int

Get the length of the queue

val clear : 'a t -> unit

Remove all elements from the queue