Register INT signal handler. After calling this, Ctrl-C will cause
all break-threads to be stopped. See 'add-break-thread!'
(defn start-handling-break
"Register INT signal handler. After calling this, Ctrl-C will cause
all break-threads to be stopped. See 'add-break-thread!'"
[]
(when (= :need-init
(swap! first-time
{:need-init false, false false, true :need-init}))
(sun.misc.Signal/handle
(sun.misc.Signal. "INT")
(proxy [sun.misc.SignalHandler] []
(handle [sig]
(let [exc (Exception. (str sig))]
(doseq [tref (vals @break-threads) :when (.get tref)]
(.stop (.get tref) exc))))))))
Comments top
No comments for start-handling-break. Log in to add a comment.