Hi,
I try to handle Control-C condition in multithreaded SBCL code. See
following snippet:
(handler-case (sb-thread:join-thread
(hunchentoot::server-listener
(start-server :port port :setuid *user* :setgid *user*)))
(sb-sys:interactive-interrupt (err) (print err)))
The handler-case doesn't get triggered though. Is there any magic I'm
missing to handle the condition?
Thanks, /S
On Dec 2, 3:56 pm, zaks <··········@gmail.com> wrote:
> I try to handle Control-C condition in multithreaded SBCL code. See
> following snippet:
>
> (handler-case (sb-thread:join-thread
> (hunchentoot::server-listener
> (start-server :port port :setuid *user* :setgid *user*)))
> (sb-sys:interactive-interrupt (err) (print err)))
>
> The handler-case doesn't get triggered though. Is there any magic I'm
> missing to handle the condition?
(As ever, you are like to receive faster response on the sbcl-help
mailing list.)
If I understand correctly, the condition occurs in the thread that is
being joined? You need to get the handler inside the thread function:
(make-thread (lambda ()
(handler-case ...
(sb-sys:interactive-interrupt (e) ...))))
Cheers,
-- Nikodemus
On Dec 4, 10:52 am, nikodemus <·················@gmail.com> wrote:
> On Dec 2, 3:56 pm, zaks <··········@gmail.com> wrote:
>
> > I try to handle Control-C condition in multithreaded SBCL code. See
> > following snippet:
>
> > (handler-case (sb-thread:join-thread
> > (hunchentoot::server-listener
> > (start-server :port port :setuid *user* :setgid *user*)))
> > (sb-sys:interactive-interrupt (err) (print err)))
>
> > The handler-case doesn't get triggered though. Is there any magic I'm
> > missing to handle the condition?
>
> (As ever, you are like to receive faster response on the sbcl-help
> mailing list.)
>
> If I understand correctly, the condition occurs in the thread that is
> being joined? You need to get the handler inside the thread function:
>
> (make-thread (lambda ()
> (handler-case ...
> (sb-sys:interactive-interrupt (e) ...))))
Thanks for the response. Your assumption is obviously right.
The thread is being spawned by the hunchentoot startup routine, so I
guess I will have to hack it to handle the condition.
Thanks again, /S