Module Busy_pollers

module Busy_pollers: sig .. end
A set of busy-poll functions.

See Scheduler.add_busy_poller for the user-level interface.


type t 
include Invariant.S
val create : unit -> t
create () creates a new empty set.
val is_empty : t -> bool
val add : t ->
(unit -> [ `Continue_polling | `Stop_polling of 'a ]) -> 'a Import.Deferred.t
add t f adds function f to the set t. f will run every time poll is called. f runs with the same execution context that was in effect when add was called. When poll is called and f returns `Stop_polling, the result of add becomes determined and f is removed from the set. Also, if f raises, it is removed from the set and the exception is sent to the monitor in effect when add was called,
val poll : t -> unit
poll t runs every function in the set t.
val sexp_of_t : t -> Sexplib.Sexp.t

create () creates a new empty set.

add t f adds function f to the set t. f will run every time poll is called. f runs with the same execution context that was in effect when add was called. When poll is called and f returns `Stop_polling, the result of add becomes determined and f is removed from the set. Also, if f raises, it is removed from the set and the exception is sent to the monitor in effect when add was called,

poll t runs every function in the set t.