From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=NO_REAL_NAME,SPF_PASS autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 51DBBBC6B for ; Thu, 28 Jun 2007 12:15:31 +0200 (CEST) Received: from electre.pasteur.fr (electre.pasteur.fr [157.99.64.120]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5SAFUxp019772 for ; Thu, 28 Jun 2007 12:15:31 +0200 Received: from fennel.sysbio.pasteur.fr (fennel.sysbio.pasteur.fr [157.99.164.38]) by electre.pasteur.fr (8.12.11/8.12.11) with ESMTP id l5SAFTHs143291 for ; Thu, 28 Jun 2007 12:15:29 +0200 (CEST) Message-ID: <46838A30.5060904@crans.org> Date: Thu, 28 Jun 2007 12:15:12 +0200 From: sayan@crans.org User-Agent: Mozilla-Thunderbird 2.0.0.4 (X11/20070621) MIME-Version: 1.0 To: Caml-list Subject: Re: [Caml-list] Waiting for float time References: <4682DCDF.5000301@crans.org> <4682E2D9.4050207@rftp.com> In-Reply-To: <4682E2D9.4050207@rftp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Miltered: at discorde with ID 46838A43.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; threads:01 gtk:01 ocaml:01 nanosleep:01 crans:98 crans:98 idiom:01 wrote:01 wrote:01 unix:01 unix:01 caml-list:01 descriptor:02 suggestion:03 float:03 Robert Roessler wrote: > sayan@crans.org wrote: >> I am looking for a floating point version of the function Unix.sleep in >> order to suspend execution of a program for 0.7s >> >> Is there any such function in the standard library ? >> >> Is there a solution outside of Threads, and GTK ? >> >> I have looked at Unix.interval_timer but I'd rather not use it. From >> what I understand, you have to add a signal handler to catch sigalrm, >> and I do not see how to create a sleep function using it. >> >> Is there a multiplatform solution ? > > I believe the OCaml idiom for this is to use Unix.select with empty > lists for all THREE of the descriptor lists... and this does work on > Windows. > > There may be better solutions... ;) > Thanks for the suggestion, I would never have thought of polling for this. :) What about wrapping usleep or nanosleep ? These are probably not portable, but are there obvious reasons not include them in the Unix library ? -- Sébastien