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:
10
examples/sigaction.janet
Normal file
10
examples/sigaction.janet
Normal 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))
|
||||
Reference in New Issue
Block a user