Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Thread.delay, Unix.select, Unix.gettimeofday, Sys.time together?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nick Name <nick.name@i...>
Subject: [Caml-list] Thread.delay, Unix.select, Unix.gettimeofday, Sys.time together?
Hi all,

I have a cycle similar to the following in my program:

while true do 
	Thread.delay mydelay; 
	print_float Unix.gettimeofday (); 
	print_newline()
done

If I put the delay into the cycle, I can't get less than 1/100 of second
delay, on any machine I do this test. Is there a portable function that
can do a shorter delay, say 1/1000 of second ad least?

BTW, I have found a problem in using Sys.time and Thread.delay together:
if I DON'T use Thread.delay, Sys.time returns an increasing value, as
it's expected to. If I do a cycle like

while true do 
	Thread.delay mydelay; 
	print_float Sys.time (); 
	print_newline()
done

Sys.time returns an almost constant value! This also happens if I use
Unix.select [] [] [] mydelay instead of Thread.delay. I suspect this
happens because some sort of counter gets reset by a delay, but this
makes no sense.

If this might be a bug I'll do the bug report.

thanks for attention

Vincenzo

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners