1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-01 08:03:02 +00:00

Add os/sigaction for signal handling.

Also improve interrupts to work better with busy loops
and signals.
This commit is contained in:
Calvin Rose
2023-08-19 13:13:22 -05:00
parent 2ac36a0572
commit f45571033c
5 changed files with 150 additions and 42 deletions

10
examples/sigaction.janet Normal file
View File

@@ -0,0 +1,10 @@
(defn action []
(print "Handled SIGHUP!")
(flush))
(defn main [_]
# Set the interrupt-interpreter argument to `true` to allow
# interrupting the busy loop `(forever)`. By default, will not
# interrupt the interpreter.
(os/sigaction :hup action true)
(forever))