RSS Feed

Lisp Project of the Day


You can support this project by donating at:

Donate using PatreonDonate using Liberapay

Or see the list of project sponsors.


Tests 😀
CI 🥺

This system provides a simple thread synchronization primitive called Rendezvous. It allows exchanging pieces of data between threads.

Here is how it works. You create a rendezvous object. Then you might create one or many threads and each of them can either to "call" rendezvous and pass it some value or to "accept" value and return a result.

Accept blocks the calling thread until some other thread will not call and vice-versa. This is similar to a thread-safe blocking queue of size 1:

POFTHEDAY> (defparameter *r*

POFTHEDAY> (bt:make-thread
            (lambda ()
              (log:info "Waiting for value")
              (let ((value (thread.comm.rendezvous:accept-rendezvous *r*)))
                (log:info "Value received: ~S" value))))

<INFO> [2020-07-21T23:06:56.836061+03:00] Waiting for value

POFTHEDAY> (thread.comm.rendezvous:call-rendezvous

<INFO> [2020-07-21T23:07:46.642640+03:00] Value received: :THE-VALUE-TO-BE-SENT-TO-THE-THREAD

I wasn't able to imagine a more complex but short illustration of the case where this synchronization primitive can be useful. If you know one, please share your ideas in comments.

Brought to you by 40Ants under Creative Commons License