]> xenbits.xensource.com Git - xcp/xen-api-libs.git/commitdiff
CP-1245: Function to be called by a daemonized process to keep alive
authorRob Hoes <rob.hoes@citrix.com>
Mon, 5 Oct 2009 15:08:56 +0000 (16:08 +0100)
committerRob Hoes <rob.hoes@citrix.com>
Mon, 5 Oct 2009 15:08:56 +0000 (16:08 +0100)
Signed-off-by: Rob Hoes <rob.hoes@citrix.com>
stdext/threadext.ml
stdext/threadext.mli

index aa3a77c505a9699c4e17106d505169de659c872a..16cc396144462b76be6b1777a02c0b22920fd26e 100644 (file)
@@ -162,3 +162,9 @@ module Delay = struct
         | None -> x.signalled <- true   (* If the wait hasn't happened yet then store up the signal *)
       )
 end
+
+let keep_alive () =
+       while true do
+               Thread.delay 20000.
+       done
+       
index 89c052aeb4029ae69952163d57f80b53798dff42..1aa8e93f679e3ba083677ed83394af12b8cfe5cc 100644 (file)
@@ -42,3 +42,7 @@ module Delay :
     (** Sends a signal to a waiting thread. See 'wait' *)
     val signal : t -> unit
   end
+  
+(** Keeps a thread alive without doing anything. Used e.g. in XML/RPC daemons. *)
+val keep_alive: unit -> unit
+