Ocamlnet 3 Reference Manual : Uq_engines.engine

# Class type Uq_engines.engine

    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`).

## Requirements for engines

    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 event_system : Unixqueue.event_system

Returns the event system the engine is attached to