Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

lisp threads

4 views
Skip to first unread message

Tamas Papp

unread,
Jun 9, 2007, 9:01:10 AM6/9/07
to
Hi,

I need a thread to run in the background without interrupting the flow
of my program (refresh an X window if exposed). I tried to read about
threads in Lisp on Cliki: bordeaux-threads doesn't support my
implementation (CMUCL, I could switch to SBCL if necessary) [1],
claiming that there are no threads in in CMUCL, yet CMUCL's
documentation says that "CMUCL supports Lisp threads for the x86
platform." [2]

Questions:

1. what are "Lisp threads" that CMUCL supports? Where could I learn
more about them?

2. what is the portable (at least on Linux) way to write threads in
Common Lisp?

3. are there any good tutorials for getting started?

Thanks,

Tamas

[1] http://common-lisp.net/project/bordeaux-threads/
[2] http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc66

Chun Tian

unread,
Jun 9, 2007, 11:47:10 AM6/9/07
to
On Jun 9, 9:01 pm, Tamas Papp <tkp...@gmail.com> wrote:
> Hi,
>
> I need a thread to run in the background without interrupting the flow
> of my program (refresh an X window if exposed). I tried to read about
> threads in Lisp on Cliki: bordeaux-threads doesn't support my
> implementation (CMUCL, I could switch to SBCL if necessary) [1],
> claiming that there are no threads in in CMUCL, yet CMUCL's
> documentation says that "CMUCL supports Lisp threads for the x86
> platform." [2]
>
> Questions:
>
> 1. what are "Lisp threads" that CMUCL supports? Where could I learn
> more about them?

CMUCL doesn't support native pthreads, only green threads, in one cpu.
I
think you should turn to SBCL, which support pthreads in sb-thread, if
you want SMP support,

See http://www.sbcl.org/manual/Threading.html#Threading

It seems that the Bordeaux Threads[1] project you gave is a better
solution,
portable lisp code is better.

Alex Mizrahi

unread,
Jun 9, 2007, 3:24:16 PM6/9/07
to
(message (Hello 'Tamas)
(you :wrote :on '(Sat, 09 Jun 2007 15:01:10 +0200))
(

TP> documentation says that "CMUCL supports Lisp threads for the x86
TP> platform." [2]

CMUCL has green threads -- this means that scheduling is performed in
user-space, by CMUCL itself, unlike "real" kernel-scheduled threads.
afair there are two modes for CMUCL thread scheduling -- one needs explicit
calls to (yield), where scheduler can switch thread.
second mode uses UNIX signal to switch threads periodically.
later approach might work in your case, but afaik it's not 100% supported.

TP> 2. what is the portable (at least on Linux) way to write threads in
TP> Common Lisp?

it's not a big deal -- spawning a thread is just one function, so you can
write your own "portable" function with help of #+.

besides that, there are plenty of sinchonization things -- mutexes,
semaphores etc. it's a bit more complex and varies between implementations.

if that bordeaux-threads do not suit you, you can check KMRCL[1] -- it's a
bigger library with many stuff. it's threading compatibility wrappers seem
to include support for CMU, SB, ACL and Lispworks.
although i suspect there might be a better one..

[1]: http://files.b9.com/kmrcl

)
(With-best-regards '(Alex Mizrahi) :aka 'killer_storm)
"I am everything you want and I am everything you need")


0 new messages