I can't cancel my window when sleep-function is executed

Started by alex, June 12, 2005, 09:54:07 AM

Previous topic - Next topic

alex

I can't cancel my window when sleep-function is executed

 

Example:

 (while (= 1 1) (sleep 60000) )



If I hit Ctrl-C, I must wait up to 60 sec

It is normal?

Lutz

#1
Only on UNIX it lets you break out during sleep. As a workaround try the following:



(define (mysleep ms)
        (let (start (time-of-day))
        (while (> (+ start ms) (time-of-day)) (sleep 10))))


Lutz



This code will let you break out with Ctrl-C



ps: note that 'time-of-day' wraps around at midnight

alex

#2
Thank Your. I will try.

alex

#3
for WINDOWS it is the same as  

  (while (= 1 1) (sleep 10) )

It is right?