threadmilambda

2026-11-29

ThreadMILambda makes writing portable multi-threaded code simple(r). Notes: This library is a fork of Bordeaux Threads, moved to... Milan (or Miλan).

Upstream URL

gitlab.common-lisp.net/mantoniotti/threadmilambda

Author

Marco Antoniotti <marco.antoniotti@unimib.it>, Marco Antoniotti <marco.antoniotti@unimib.it> et al.

License

MIT
README

Threadmiλ -- A Common Lisp threading library

Copyright (c) 2021-2026 Marco Antoniotti et al. See file COPYING for licensing information

Description

Threadmiλ ("Threadmil") is a fork of the well known Bordeaux Threads library that aims to make it even more CL-centric and fix the semantics of a few constructs, most notably the timeout machinery.

The name of the library comes from the fact that it is a threading library now worked on in Milan. The λ is de rigueur.

Threadmiλ implements, depending on the underlying CL, the following threading facilities.

  • Threads
  • Locks
  • Semaphores
  • Condition Variables
  • Timers
  • Mailboxes
  • Barriers
  • Atomics
  • Timeouts

These are the facilities available in most CL, especially Lisworks.

Current Implementation Status

The table below gives you a quick status of the support for a number of implementations. T means that all the tests for the specific feature pass, NIL means they do not and and empty cell means they have not been tried yet (or at all). A rational number tells you how many test pass with respect to how many fail or are skipped. The test suite uses 5am.

LWSBCLECLABCLCCLACL
ThreadsTTTTTT
Locks (1)T14/17TT15/2114/18
SemaphoresTTTTTT
Condition VarsTTTTTT
TimeoutsTTTT (2)TT
TimersTTTTTT
MailboxesTTTTTT
BarriersTT11/12TTT
AtomicsTTTTTT

Note that the table simply reflects the current compliance with the set of tests. Adding some tests may change the entries in the table.
(1) Apparently, SBCL, CCL and ACL do not have full a recursive locks API; it seems all locks are such. The missing bits are different and this is reflected in the number of tests actually performed. In the future the regular API may be used and the missing tests will just work.
(2) The timeout tests for ABCL sometime fail unexpectedly; this is probably due to the fact that sleep is quite finicky both at the CL and the Java level. Tracking down why is left as an exercise for the ABCL developers.

Documentation

The documentation strings should be adequate. If not, refer to the Lispworks MP package documentation for details; Threadmiλ is patterned after it.

Differences with Bordeaux Threads

The main difference is architectural. Threadmiλ is essentially divided in two packages, a "public", front end, one and a "private", back end, or lower-level one. The public package has nickname THREADMIL (it has other ones as well), while the back end one has nickname THREADMIL-IMPL-DEP (again, it has other ones as well).

The Threadmiλ public API is all exported from the public package. The back end package contains the implementation dependent code; the actual implementation dependent code is in the files src/impl-dep/impl-XXX.lisp. The conditionalization required to handle the proper loading of each implementation dependent file is moved to the system, .asd or .system, file.

This is the main difference between Threadmiλ and Bordeaux Threads (BT). BT keeps everything in a single package with the conditionalizations appearing in each separate function.

Apart from that, Threadmiλ expands the set of concurrency tools beyond BT, and strives to clearly define and homogenize each type and function signature.

Yet, Threadmiλ does not try (yet) to support several implementations: CLASP, CORMAN, GENERA, MEZZANO, MKCL, SCL. Also, there is not support for CMUCL and CLISP, yet.

Installation

Threadmiλ will eventually be available on quicklisp

Otherwise, installation should be simple if you have ASDF or MK:DEFSYSTEM set up.

Dependencies

Threadmiλ depends only on global-vars (which in turn depends on a number of other libraries).

Apart from that, Threadmiλ uses the venerable FIVEAM testing framework, which must be available before compiling the testing (sub)system.

ASDF

Assuming you have downloaded the source code and you are in the top directory (within your CL REPL of course), you just run:

CL-USER> (load "threadmilambda.asd") ; Yes. LOAD.
...
CL-USER> (asdf:compile-system "threadmilambda")
...

CCL has a few issues with ASDF. Use MK:DEFSYSTEM in this case.

MK:DEFSYSTEM

Assuming you have downloaded the source code and you are in the top directory (within your CL REPL of course), you just run:

CL-USER> (load "threadmilambda.system")
...
CL-USER> (mk:compile-system "threadmilambda")
...

Testing

To run the tests you can use asdf:test-op. This does not work in ECL; if this is your case, you will have to use 5am:run! directly (see below).

CL-USER> (asdf:oos 'asdf:test-op "threadmilambda")
...

If the above does not work, or if you want to use MK:DEFSYSTEM, you must compile the testing system separately as follows:

CL-USER> (asdf:compile-system "threadmilambda/tests")
...

or

CL-USER> (mk:compile-system "threadmilambda-tests") ; Note the system's name.
...

Assuming the testing system is loaded (either by ASDF or MK:DEFSYSTEM), you can run the full test suite with the following call:

CL-USER> (5am:run! 'threadmil-tests:threadmil-tests)
...

A Note on Forking

Of course you are free to fork the project subject to the current licensing scheme. However, before you do so, I ask you to consider plain old "cooperation" by asking me to become a developer. It helps keeping the entropy level at an acceptable level.

Of course, in this case, I did not heed my own advice, and yet...

Enjoy

Marco Antoniotti 2026-10-24

Dependencies (2)

  • fiveam
  • global-vars

Dependents (0)

    • GitHub
    • Quicklisp