guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: signal handling not working in threaded guile?


From: Marco Maggi
Subject: Re: signal handling not working in threaded guile?
Date: Mon, 14 May 2007 21:37:05 +0200

"Andy Wingo" wrote:
> When I try to sleep, but control-C in the middle of
> it, I get some strange behavior:
>
>guile> (sleep 5)
>$1 = 4
>guile>
>ERROR: User interrupt
>ABORT: (signal)
>guile>

> It seems that we get the value back, *and* the error
> thrown.



Isn't it correct? An async is a thunk evaluated
asynchronously with respect to the normal evaluation flow,
for example when we do a 'select()' (grep the Guile source
for SCM_TICK to see where).

The documentation of 'sleep' does not say that the procedure
will not return. 'sleep' itself is implemented with a call
to 'select()'.

By experimenting with the following script what do you
see as incorrect?

;; -----------------------------------------
(define a 0)

(sigaction SIGINT
           (lambda (. arg)
             (set! a (1+ a))))

(format #t "sleep ~A~%" (sleep 5))

(format #t "result ~A~%" a)

(do ((i 1 (1+ i)))
    ((> i 1000000))
  #f)

(format #t "result ~A~%" a)

;; -----------------------------------------

--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]