class type virtual [[> 'a state_t ]]
event = object
.. end
The type of objects representing an I/O events that produce results of
type 'a
.
val mutable state_ : [> 'a state_t ] as 'b
The current state of the I/O event.
val mutable put_ : < get : 'a > Queue.t option
An optional queue of I/O events producing results of type 'a
provided in the load
method.
method private virtual service : t -> 'b
The self#service p
method is invoked in the cycle for the
polling mux p
when the event is ready to be serviced. The method
is virtual to accomodate specializations with intermediate state
and event handling functionality.
method private load_ : t -> unit
The self#load_ p
method is invoked in the load
method to load
the specialized event into the polling mux p
.
method private unload_ : t -> unit
The self#unload_ p
method is invoked in the unload
method to
unload the specialized event from the polling mux p
.
method load : ?q:< get : 'a > Queue.t -> t -> unit
Use obj#load ?q p
to load the event into the collection of
pending events at the polling mux p
. Sets the state_
member
to `Loaded p
. If the event is already loaded into a polling mux,
it is unloaded first. If the optional ?q
argument is provided,
then the put_
member is set accordingly.
method unload : unit
Use obj#unload
to remove the event from the collection of pending
events in a polling mux. Sets the state_
member to `Unloaded
.
method canget : bool
Returns false
if the event requires service by a polling mux
before a result may be obtained with the get
method.
method get : 'a
Get the final result of the I/O event. Raises Not_ready
if the
event requires more service by a polling mux. If the state of
the event is `Exception x
, then the exception x
is raised.