class type['t]
engine =object
..end
This class type defines the interface an engine must support. The
class parameter 't
is the type of the result values (when the
engine goes to state `Done
).
method state : 't engine_state
Returns the state of the engine
method abort : unit -> unit
Forces that the engine aborts operation. If the state is already
`Done
, `Aborted
, or `Error
, this method must do nothing (you
cannot abort an already finished engine).
method request_notification : (unit -> bool) -> unit
Requests notification about state changes.
After the notification has been requested, the passed function must
be called whenever state
changes its value (or might change
its value; it is allowed to call the notification function more
frequently than necessary). The function returns true
if there
is still interest in notification, and false
if notification must
be disabled; the function must not be called any longer in this
case.
There can be any number of parallel active notifications. It is allowed that a notification callback function requests further notifications.
If the callback raises an exception, this exception is
propagated to the caller of Unixqueue.run
.
method request_proxy_notification : ('t engine -> bool) -> unit
Requests to call back the function when there is another engine
that can be used as proxy for this object. Note that this is a pure
optimization for qseq_engine
, and is normally not implemented
for any other engine construction. It is ok to define this method
as a no-op.
method event_system : Unixqueue.event_system
Returns the event system the engine is attached to