Broken OCaml bindings for libev
Other software I've written.
Libev is a
high-performance event loop capable of using different kinds of
polling mechanisms provided by different operating systems.
From this page you will find Objective Caml bindings to it.
There is a GC related issue that will eventually cause a
segmentation violation, so it is not advisable to use this for
anything except small hacks :-). The latest darcs version will
crash if you comment out the line 'Hashtbl.add foo () v;' which
keeps references to created event watchers, so solution should be
near..
Download ocaml-ev v 0.4 and
libev
3.0. An experimental
combined package is also available (might require tweaking to
compile); it features a CVS HEAD version from the libev
repository, featuring asynchronous messaging. The produced library
will statically contain libev. These two versions are likely to be
merged to some point.
You may compile the bindings with "make all" and install via
"sudo make libinstall". Ocaml-ev uses OCamlMakefile
as its build system.
Changes v0.3v-0.4
- changed parameter order in _init-functions, now the call back function is the last argument, in order to facilitate continuation passing style
- added Ev.set_exn_handler to customize exception handling; if that function throws, it'll leak out of Ev.loop
- don't throw an exception if calling Ev.start/stop too many times, like the original library
- provide Ev.set_keepalive to replace Ev.incr_ref and .decr_ref, which are more error prone - similar to EV.pm
- added some test cases/examples (uses OUnit)
Changes v0.2-v0.3
- fixed initialializing library properly, now both native and byte code libraries should work..
- safe support for ev_ref/ev_unref as incr_ref and decr_ref
- set_io/timeout_collect interval added
- fixed parameter type to Ev.loop
- toplevel still doesn't work with #use "topfind" #require "ev" :( (works with the toplevel produced with "make top")
Changes v0.1-v0.2
- actually produce libraries that may be used
(they used to segfault due to file name collision). For some
reason using it with findlib/toplevel with #use "topfind" and
#require "ev" doesn't work; you may still produce a standalone
toplevel with this with ocamlfind ocamlmktop -linkpkg -o top
-package ev, though.
- support ev_fork
- support ev_stat
- implement CAMLreturnT if not provided by caml headers; allows compiling with older Ocamls
- refactored the C-file to be a bit shorter (macros for accessors, woohoo!)
Ocaml-ev has been successfully compiled with under Linux with ocamlc 3.10.1 and libev 3.0.
Documentation, example
You may also access the latest version (even with a web browser) from the Darcs
repository. Enter
darcs get http://www.modeemi.cs.tut.fi/~flux/software/darcs/ocaml-ev
or
darcs get http://www.modeemi.cs.tut.fi/~flux/software/darcs/ocaml-ev-with-libev
to fetch your copy.
Erkki Seppala
Last modified: Fri Mar 7 09:33:41 EET 2008