mirror of
https://github.com/ocaml-multicore/eio.git
synced 2025-11-22 00:09:09 -05:00
Cancellation and grouping are easier to handle separately. `Fibre.both` no longer takes a switch, but instead just creates a new cancellation context.
21 lines
741 B
OCaml
21 lines
741 B
OCaml
module Key : sig
|
|
type t
|
|
end
|
|
|
|
type t
|
|
(** A queue of scheduled events. *)
|
|
|
|
val create : unit -> t
|
|
(** [create ()] is a fresh empty queue. *)
|
|
|
|
val add : cancel_hook:Eio.Hook.t ref -> t -> float -> unit Suspended.t -> Key.t
|
|
(** [add ~cancel_hook t time thread] adds a new event, due at [time], and returns its ID.
|
|
[cancel_hook] will be released when the event is later returned by {!pop}. *)
|
|
|
|
val remove : t -> Key.t -> unit
|
|
(** [remove t key] removes an event previously added with [add]. *)
|
|
|
|
val pop : t -> now:float -> [`Due of unit Suspended.t | `Wait_until of float | `Nothing]
|
|
(** [pop ~now t] removes and returns the earliest thread due by [now].
|
|
If no thread is due yet, it returns the time the earliest thread becomes due. *)
|