https://github.com/ruricolist/moira
Monitor and restart background threads.
https://github.com/ruricolist/moira
Last synced: 2 months ago
JSON representation
Monitor and restart background threads.
- Host: GitHub
- URL: https://github.com/ruricolist/moira
- Owner: ruricolist
- Created: 2015-11-23T19:43:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-11-23T17:51:33.000Z (over 2 years ago)
- Last Synced: 2024-05-19T05:35:06.657Z (almost 2 years ago)
- Language: Common Lisp
- Size: 7.81 KB
- Stars: 29
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- curated-awesome-cl - Moira - Monitor and restart background threads. In-lisp process supervisor. [MIT][200]. (Python ##)
- awesome-cl - Moira - Monitor and restart background threads. In-lisp process supervisor. [MIT][200]. (Interfaces to other package managers / Third-party APIs)
README
# Μοῖρα
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`:
(moira:start-monitor)
Once the monitor is started, you can spawn new threads:
(moira:spawn "Background worker"
...))
Which is syntactic sugar for
(moira:spawn-thread
(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`
(moira: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.
You can avoid the Osicat dependency, and not have this latest feature
on Linux, by loading `moira/light`.