[erlang-questions] Unexpected behaviour of timer:sleep

Bengt Kleberg bengt.kleberg@REDACTED
Wed Mar 19 14:14:05 CET 2008


Greetings,

Have you tested

receive
after 1 -> ok
end.

It might be more accurate.


bengt

On Wed, 2008-03-19 at 17:53 +0530, shehan wrote:
> In WindowsXP. 
> 
> How ever in Red Hat Enterprise Linux ES release 3, below result came. It is
> also more than that. So timer:sleep(1) cannot be used as it is. I need to
> suspend process for 1 millisecond. But it is suspend 12 or 13 milliseconds.
> Then my requirement cannot be achieved.
> 
> (test@REDACTED)1> timer:tc(timer, sleep, [1]).
> {11945,ok}
> (test@REDACTED)2> timer:tc(timer, sleep, [1]).
> {12680,ok}
> 
> -----Original Message-----
> From: erlang-questions-bounces@REDACTED
> [mailto:erlang-questions-bounces@REDACTED] On Behalf Of Bjorn Gustavsson
> Sent: Wednesday, March 19, 2008 4:58 PM
> To: erlang-questions@REDACTED
> Subject: Re: [erlang-questions] Unexpected behaviour of timer:sleep
> 
> "shehan" <shehan@REDACTED> writes:
> 
> > Hi all,
> > 
> > When I am running following command, unexpected value came as result. Why
> is
> > that??
> > 
> >  
> > 
> > (test@REDACTED)15> timer:tc(timer, sleep, [1]).  
> > 
> > {15000,ok}
> > 
> 
> Which operating system do you run Erlang on? 
> 
> /Bjorn




More information about the erlang-questions mailing list