forked from ahrefs/devkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmVar.mli
More file actions
27 lines (18 loc) · 642 Bytes
/
mVar.mli
File metadata and controls
27 lines (18 loc) · 642 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(** Variable shared between threads *)
type 'a t
(** Create *)
val create : unit -> 'a t
(** Set the variable (overwriting previous value if any) and return immediately *)
val set : 'a t -> 'a -> unit
(** Unset the variable *)
val clear : 'a t -> unit
(** Get value (block until it is available) *)
val get : 'a t -> 'a
(** Get value (block until it is available) and unset *)
val grab : 'a t -> 'a
(** Get value immediately without blocking
@return None if value was not set *)
val try_get : 'a t -> 'a option
(** Grab value immediately without blocking
@return None if value was not set *)
val try_grab : 'a t -> 'a option