module Duppy:Advanced scheduler and monad for server-oriented programming.sig
..end
The bars could not hold me; Force could not control me now. They try to keep me down, yeah! But Jah put I around. (...) Let me tell you this - I'm a duppy conqueror !
Duppy task scheduler for OCaml.
Duppy
is a task scheduler for ocaml. It implements a wrapper
around Unix.select
.
Using Duppy.Task
, the programmer can easily submit tasks that need to wait
on a socket even, or for a given timeout (possibly zero).
With Duppy.Async
, one can use a scheduler to submit asynchronous tasks.
Duppy.Io
implements recursive easy reading and writing to a Unix.file_descr
Finally, Duppy.Monad
and Duppy.Monad.Io
provide a monadic interface to
program server code that with an implicit return/reply execution flow.
The scheduler can use several queues running concurently, each queue
processing ready tasks. Of course, a queue should run in its own thread.
type 'a
scheduler
'a
is the type of objects used for priorities.
exception Panic of exn
val create : ?compare:('a -> 'a -> int) -> unit -> 'a scheduler
compare
: the comparison function used to sort tasks according to priorities.
Works as in List.sort
val queue : ?log:(string -> unit) ->
?priorities:('a -> bool) -> 'a scheduler -> string -> unit
queue ~log ~priorities s name
starts a queue, on the scheduler s
only processing priorities p
for which priorities p
returns true
.
Raises Panic exception
if exception
was raised while executing
the main event loop.
Several queues can be run concurrently against s
.
log
: Logging function. Default: Printf.printf "queue %s: %s\n" name
priorities
: Predicate specifying which priority to process. Default: fun _ -> _ -> true
val stop : 'a scheduler -> unit
module Task:sig
..end
module Async:sig
..end
module Io:sig
..end
Unix.file_descr
.
module Monad:sig
..end
Duppy.Io
.