invoke-handlers error on CCL/linux
Closed this issue · 2 comments
ralt commented
A simple file like this:
(ql:quickload :trivial-signal)
(trivial-signal:signal-handler-bind ((2 (lambda (c)
(format t "hi!~%"))))
(sleep 99))
If you try to Ctrl-c during the sleep, it throws this error:
^C-------- handler invoked in thread: listener -------
hierarchy: (((2 #<Anonymous Function #x30200161994F>)))hi!
> Error: received INT
>
> While executing: TRIVIAL-SIGNAL::INVOKE-HANDLERS, in process listener(1).
> Type :GO to continue, :POP to abort, :R for a list of available restarts.
> If continued: Skip evaluation of (ros:run '((:eval"(ros:quicklisp)")(:script "../test.lisp")(:quit ())))
> Type :? for other options.
By replacing 2
with "foo"
, I saw an interesting error at compile-time:
> Error: The value "foo" is not of the expected type SYMBOL.
So ccl apparently expects signo
to be a symbol, not a number.
That said, it throws the same error when I tried using 'foo
:
> Error: The value 'FOO is not of the expected type SYMBOL.
So I'm not sure what it's expecting.
guicho271828 commented
So, three questions...
- Why it throws an error, although I handled the signal? -> The behavior of
signal-handler-bind
is analogous tohandler-bind
. Therefore your code did not handle the signal, you declined the signal. To see this difference, please refer to the definition of handle and decline: You printed "hi" and returned from thelambda
without a local exit, so you declined the signal. To handle the signal, you have to jump outside the handler via non-local exit such astagbody+go
orblock+return-from
orthrow+catch
combo. - The valid designator for signals are defined here: It should be a keyword or a number.
- This case is interesting, what you saw is actually
'FOO
notFOO
, which means it is a cons(quote foo)
that happened to be pretty-printed. This is confusing for the users and I believe it is a bug.
ralt commented
Thanks for the explanation! I was indeed missing things :)