skaller wrote:
On Sat, 2007-08-04 at 12:29 +0200, Philippe Wang wrote:
  
tmp123@menta.net wrote:
    

  
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.
      
You must keep a list of functions to fire off at a given time,
so the map will be

	time -> timerid list

and you'll also need timerid -> time * (unit->unit) to fetch the
function from the id.

  
Hello,

Thanks for the sugestion.

It seems dificult to generate an unique identifier, for this subject or any other (in this sense, I feel nostalgic of the old C pointers).

An integer counter could be valid, but, when the counter reaches the maximum, the counter needs to return to "0". From now on, before to return a new identifier, it should be checked if this value is already in use. And that means O(n).

I do not see solution for that.

Kind regards.