I have one at http://pllab.kaist.ac.kr/~shoh/ocaml/libs/timer/ .

Module Timer


module Timer: sig .. end
timer library. This library uses Sys module and unix, thread library.

type id 
callback id. This is returned from registering timer callback and used for unregistering.
val init : ?tck_unit:float -> unit -> unit
initializer timer library. This should be called before calling any timer function.

tck_unit : tick unit of tick timer. (default value is 100 milli seconds)
val reset : unit -> unit
reset timer library. Timer functions can be called anymore.
val register : (unit -> unit) -> float -> float -> id
register callback. register f start interval registers callback fucntion f which will be called after start milli seconds at first and every interval milli seconds after the first calling. If interval is zero, the callback function is called only once.
Returns id the registered callback id.
val unregister : id -> unit
unregister callback.
val msleep : float -> unit
sleep for the given time in milli seconds.

Anastasia Gornostaeva 쓴 글:
Hello.

Does exist Timer module, that allows me add/reset/remove timed events?
Currently I use Unix.setitimer() for my simple implementation that allows
only adding new events into a queue, but my skills is not enough to implement
reset and remove events from the Timer queue.
And I'm not sure if using Unix.sleep() with setitimer() is safely (without
Threads).
Thanks.

ermine

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs