From: Vilho =?utf-8?B?UsOkaXPDpG5lbg==?=
Subject: multi-threading BCPs
Date: 
Message-ID: <871w1tt0id.fsf@iki.fi>
Greetings,

could you point me to best current practices information relating to
Common Lisp threads? More specifically, I'd be interested in signal
handlers across threads in SBCL. I'm running my app atop Ubuntu (with native
kernel thread support).

Reading the User Manual, one way would seem to be have signal handler
sitting on a condition variable. Is there a more elegant pre-existing
way? Just thought to ask before creating syntactic sugar of my own as
JFGIng the topic didn't seem to produce results.

Thanks in advance,

  Vilho.

-- 
From: George Neuner
Subject: Re: multi-threading BCPs
Date: 
Message-ID: <8puu74pve0ddtsv4ogbpt9ab8hlpfilosi@4ax.com>
On Thu, 17 Jul 2008 10:47:54 +0300, ···@iki.fi (Vilho R�is�nen) wrote:

>Greetings,
>
>could you point me to best current practices information relating to
>Common Lisp threads? More specifically, I'd be interested in signal
>handlers across threads in SBCL. I'm running my app atop Ubuntu (with native
>kernel thread support).
>
>Reading the User Manual, one way would seem to be have signal handler
>sitting on a condition variable. Is there a more elegant pre-existing
>way? Just thought to ask before creating syntactic sugar of my own as
>JFGIng the topic didn't seem to produce results.
>
>Thanks in advance,
>
>  Vilho.

I don't use SBCL but just in general: a system signal interrupts
execution of the current thread - the handler is executed and then
thread resumes or is rescheduled.  Normally the thread is not aware
that it was interrupted, so the handler code must notify any threads
that are waiting on the signal.

If you have symmetric server threads and don't care which thread
responds, then a semaphore or condition variable with wait queue is
the best choice.  If several threads must all respond, it's better to
use a mutex or event (if you have them) that they can all wait on
simultaneously.  Also some semaphore implementations allow you to
release N waiting threads at a time rather than just one - that lets
them act like flexible mutexes.

George
--
for email reply remove "/" from address