From: zaks
Subject: SBCL Control-C handling question
Date: 
Message-ID: <65035bc0-61fa-4589-8123-65cf6e8027d1@j39g2000yqn.googlegroups.com>
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

From: nikodemus
Subject: Re: SBCL Control-C handling question
Date: 
Message-ID: <84f24c84-5e27-4778-a7e8-a9285a97f883@d23g2000yqc.googlegroups.com>
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
From: zaks
Subject: Re: SBCL Control-C handling question
Date: 
Message-ID: <8759ebac-a50e-4d19-b198-44012e4db760@t3g2000yqa.googlegroups.com>
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