unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* signal handling not working in threaded guile?
@ 2007-05-10 16:58 Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2007-05-10 16:58 UTC (permalink / raw)
  To: guile-user

Hi all,

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. That is,
the async is not executed until *after* the value was returned. Is this
expected? What's going on here?

Andy.
-- 
http://wingolog.org/


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: signal handling not working in threaded guile?
@ 2007-05-14 19:37 Marco Maggi
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Maggi @ 2007-05-14 19:37 UTC (permalink / raw)
  To: guile-user

"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"



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-14 19:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-10 16:58 signal handling not working in threaded guile? Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2007-05-14 19:37 Marco Maggi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).