Version française
Home     About     Download     Resources     Contact us    
Browse thread
Waiting for float time
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: sayan@c...
Subject: Re: [Caml-list] Waiting for float time
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