]> xenbits.xensource.com Git - xenclient/toolstack.git/commitdiff
add utilities to make timer handles usable in stdlib datastructures.
authorPrashanth Mundkur <prashanth.mundkur@citrix.com>
Tue, 16 Jun 2009 17:12:35 +0000 (10:12 -0700)
committerPrashanth Mundkur <prashanth.mundkur@citrix.com>
Tue, 23 Jun 2009 16:41:45 +0000 (09:41 -0700)
libs/stdext/eventloop.ml
libs/stdext/eventloop.mli

index a7be1d773c31ad0f43b4abe905941587c6f0393b..b447e2ad3256ccc5255fa57811d56af4a050197a 100644 (file)
@@ -249,6 +249,9 @@ let start_periodic_timer t time_offset_sec period cb =
 let cancel_timer t timer =
        Timers.remove_timer t.timers timer
 
+let timer_compare tim1 tim2 = compare tim1.Timers.handle tim2.Timers.handle
+let timer_hash tim = tim.Timers.handle
+
 let has_timers t = not (Timers.is_empty t.timers)
 
 (* event dispatch *)
@@ -358,8 +361,6 @@ let dispatch_timers t =
                end
        done
 
-let timers_empty t = Timers.is_empty t.timers
-
 let dispatch t interval =
        t.current_time <- Unix.gettimeofday ();
        let interval =
index c8d74678f71fd08017bd47f7d2164cbcd44b4e73..8f11007fdfc995bc7858e3d4b62d078e878edab6 100644 (file)
@@ -79,6 +79,9 @@ val start_periodic_timer: t -> float (* offset from current time, secs *) -> flo
 *)
 val cancel_timer : t -> timer -> unit
 
+(** Utilities for storing timer handles in data structures. *)
+val timer_compare: timer -> timer -> int
+val timer_hash: timer -> int
 
 (* Event Dispatch *)