package duppy

  1. Overview
  2. Docs

Core task registration. * * A task will be a set of events to watch, and a corresponding function to * execute when one of the events is trigered. * * The executed function may then return a list of new tasks to schedule.

type ('a, 'b) task = {
  1. priority : 'a;
  2. events : 'b list;
  3. handler : 'b list -> ('a, 'b) task list;
}

A task is a list of events awaited, * and a function to process events that have occured. * * The 'a parameter is the type of priorities, 'b will be a subset of possible * events.

type event = [
  1. | `Delay of float
  2. | `Write of Unix.file_descr
  3. | `Read of Unix.file_descr
  4. | `Exception of Unix.file_descr
]

Type for possible events. * * Please not that currently, under win32, all socket used in ocaml-duppy * are expected to be in blocking mode only!

val add : 'a scheduler -> ('a, [< event ]) task -> unit

Schedule a task.