From: Rob Hoes Date: Mon, 5 Oct 2009 15:08:56 +0000 (+0100) Subject: CP-1245: Function to be called by a daemonized process to keep alive X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3dc7ef82ddec4fd5e593c323096c2da9ba7dd504;p=xcp%2Fxen-api-libs.git CP-1245: Function to be called by a daemonized process to keep alive Signed-off-by: Rob Hoes --- diff --git a/stdext/threadext.ml b/stdext/threadext.ml index aa3a77c..16cc396 100644 --- a/stdext/threadext.ml +++ b/stdext/threadext.ml @@ -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 + diff --git a/stdext/threadext.mli b/stdext/threadext.mli index 89c052a..1aa8e93 100644 --- a/stdext/threadext.mli +++ b/stdext/threadext.mli @@ -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 +