Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Multi-Threads in Common Lisp

It seems there're already several thread implementations, as I noticed there're Bordeaux Threads, Portable-Threads, and 《The Common Lisp Cook Book》 also gives a way to implement multi-threads, the package mp which I don't known how to involve it in my program, I can't find this package.

The problem is how can I choose a proper multi-threads library to meet my demand, as I'm also a C programmer, it's better like pthread, but it doesn't matter, I wonder which it's the most used multi-threads library, or what is the regular way for multi-threads programming in Common Lisp.

like image 714
levin li Avatar asked Dec 24 '11 12:12

levin li


2 Answers

According to Quicklisp stats for November bordeaux-threads is heavily used but I don't see portable-threads or any other implementations. So I guess you could try it and see if it meets your needs and look for another implementation if it doesn't.

I've barely used it but I've found it easy to use and the API documentation is rather clear.

like image 111
Daimrod Avatar answered Oct 18 '22 09:10

Daimrod


Actually, the de facto threading standard for Common Lisp is Bordeaux Threads (bt), which is a portability layer over threading APIs of different implementations.

mp (which stands for multi-processing) is how threading API is called in LispWorks (and, if I'm not mistaken, Franz CL). You can use it directly (just like sb-thread in SBCL), if you are developing for some specific implementation, or you can rely on bt, if you aim for portability across all currently active implementations with threading support (CLISP doesn't have it at all).

like image 38
Vsevolod Dyomkin Avatar answered Oct 18 '22 08:10

Vsevolod Dyomkin