Skip to content

Commit f8ecdd3

Browse files
committed
Update doc
1 parent 917f822 commit f8ecdd3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/lf_msqueue.mli

+20
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,35 @@
1717

1818
module type S = sig
1919
type 'a t
20+
(** The type of lock-free queue. *)
21+
2022
val create : unit -> 'a t
23+
(** Create a new queue, which is initially empty. *)
24+
2125
val is_empty : 'a t -> bool
26+
(** [is_empty q] returns empty if [q] is empty. *)
27+
2228
val push : 'a t -> 'a -> unit
29+
(** [push q v] pushes [v] to the back of the queue. *)
30+
2331
val pop : 'a t -> 'a option
32+
(** [pop q] pops an element [e] from the front of the queue and returns
33+
[Some v] if the queue is non-empty. Otherwise, returns [None]. *)
34+
2435
val clean_until : 'a t -> ('a -> bool) -> unit
36+
(** [clean_until q f] drops the prefix of the queue until the element [e],
37+
where [f e] is [true]. If no such element exists, then the queue is
38+
emptied. *)
2539

2640
type 'a cursor
41+
(** The type of cursor. *)
42+
2743
val snapshot : 'a t -> 'a cursor
44+
(** Obtain a snapshot of the queue. This is a constant time operation. *)
45+
2846
val next : 'a cursor -> ('a * 'a cursor) option
47+
(** [next c] returns [Some (e, c')] where [e] is the head of the queue and
48+
[c'] is the tail, if the queue is non-empty. Otherwise, returns [None]. *)
2949
end
3050

3151
module M : S

0 commit comments

Comments
 (0)