[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Problems with thread-sleep!
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] Problems with thread-sleep! |
Date: |
Wed, 1 Dec 2010 11:57:57 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Nov 30, 2010 at 09:17:32PM +0100, Karel Miklav wrote:
> I want to slow down a script to a number of cycles per
> second with:
>
> (thread-sleep! (/ 1 12))
>
> That however fails
Fails how?
> so I ended up importing numbers and
> adapting the line to:
>
> (thread-sleep! (exact->inexact (/ 1 12)))
If I do (/ 1 12) without numbers I get 0.0833333333333333
and if I do (exact->inexact (/ 1 12)) *with* numbers I
get the same result.
> This call usually blocks within 10 retries. I don't
> have a clue what is going on and know little about
> scheme but it looks like something about numbers.
> These always work:
>
> (thread-sleep! 0.083)
>
> (thread-sleep! (/ (round (*
> (exact->inexact (/ 1 12)) 1000)) 1000))
>
> Anybody knows what is the problem?
The real question is why it blocks at all. That importing numbers
makes a difference is weird, but you shouldn't need to do that at
all.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth
- Re: [Chicken-users] Problems with thread-sleep!,
Peter Bex <=