Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: SooHyoung Oh <shoh@c...>
Subject: Re: [Caml-list] timer
I have one at .

  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 ? ?:

>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
>Caml-list mailing list. Subscription management:
>Beginner's list:
>Bug reports: