caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Sorted list
@ 2007-08-04  9:35 tmp123
  2007-08-04 10:00 ` [Caml-list] " Jon Harrop
                   ` (4 more replies)
  0 siblings, 5 replies; 40+ messages in thread
From: tmp123 @ 2007-08-04  9:35 UTC (permalink / raw)
  To: caml-list

Hello,

In order to implement a timers subsystem, I need a module with the 
following values:

*) add_timer : time -> ( unit -> unit ) -> timerid,
for public usage, where "add_timer t f" means execute "f" at time "t".  
The result is an identifier who allows cancelation of the timer.
*) cancel_timer: timerid -> unit
for public usage, cancel a previously added timer
*) peek_minimum_timer : unit -> ( time, unit -> unit )
for internal usage, get the timer with minimum time. Returns the time 
and the related function.
*) remove_minimum_timer : ?? -> unit
for internal usage, remove the timer with the minimum time. It will be 
called after execute a timer.

Thus, in a generic sense, what I need is a "sorted list", with easy 
insertion of elements, and peek/pop of the head (minimum).

Of the standard modules, the most similar seems "set", because allows 
insertion and has the funcion "min_elt". However, the problem is, if two 
timers have the same time, addition of the second one removes the first.

Please, has someone any sugestion?

Thanks a lot.


^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2007-08-12 12:05 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-04  9:35 Sorted list tmp123
2007-08-04 10:00 ` [Caml-list] " Jon Harrop
2007-08-04 10:29 ` Philippe Wang
2007-08-04 11:22   ` skaller
2007-08-04 12:23     ` Philippe Wang
2007-08-04 13:39       ` skaller
2007-08-04 14:01         ` Philippe Wang
2007-08-04 14:45           ` skaller
2007-08-04 14:27       ` tmp123
2007-08-04 20:33       ` Christophe TROESTLER
2007-08-04 14:37     ` tmp123
2007-08-04 15:09       ` Brian Hurt
2007-08-04 15:42         ` skaller
2007-08-04 16:21           ` Richard Jones
2007-08-04 17:17             ` Brian Hurt
2007-08-04 18:24               ` skaller
2007-08-04 17:54             ` skaller
2007-08-04 19:16               ` Richard Jones
2007-08-05 16:22                 ` David Allsopp
2007-08-05 16:41                   ` Xavier Leroy
2007-08-05 17:01                     ` David Allsopp
2007-08-04 17:35           ` Julien Moutinho
2007-08-04 18:04             ` skaller
2007-08-05  1:47             ` Jon Harrop
2007-08-05 11:44               ` Erik de Castro Lopo
2007-08-05 12:03                 ` Jacques GARRIGUE
2007-08-05 12:31                   ` Erik de Castro Lopo
2007-08-05 13:22                     ` Richard Jones
2007-08-05 20:47                       ` Erik de Castro Lopo
2007-08-05 13:17                 ` Richard Jones
2007-08-05 16:26           ` Xavier Leroy
2007-08-05 23:47             ` skaller
2007-08-04 15:36       ` skaller
2007-08-04 15:17     ` tmp123
2007-08-12 12:05       ` Andrej Bauer
2007-08-04 12:15 ` Brian Hurt
2007-08-04 12:36   ` Brian Hurt
2007-08-04 13:49     ` skaller
2007-08-04 12:16 ` Daniel Bünzli
2007-08-04 12:58 ` Oliver Bandel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).