Monitor and restart background threads.
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information. Minor: consistent caps. May 13, 2016
moira.asd Details. Nov 19, 2015
moira.lisp Use synchronized mixin. Nov 10, 2017
monitor.lisp Rename some functions. Nov 19, 2015
package.lisp Rename some functions. Nov 19, 2015
spawn.lisp Rename some functions. Nov 19, 2015
thread-ids.lisp Initial import. Jun 21, 2015
types.lisp Initial import. Jun 21, 2015


Moira is a simple (but not quite trivial) library for monitoring and, if necessary, restarting long-running threads. In principle, it is like an in-Lisp process supervisor.

To start the monitor, you call start-monitor:


Once the monitor is started, you can spawn new threads:

(moira:spawn "Background worker"

Which is syntactic sugar for

 (lambda () ...)
 :name "Background worker")

If the thread created by spawn-thread should crash, or otherwise exit abnormally, Moira will step in and restart the thread.

You can stop monitoring with stop-monitor


Although this will not affect the spawned threads.

On Linux only, Moira also tracks the thread ID (value of gettid) of the Lisp threads it launches. This can be useful for tracking the resource usage of individual threads.