Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Handle-a-signal/Clojure/handle-a-signal.clj
Normal file
15
Task/Handle-a-signal/Clojure/handle-a-signal.clj
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
(require 'clojure.repl)
|
||||
|
||||
(def start (System/nanoTime))
|
||||
|
||||
(defn shutdown [_]
|
||||
(println "Received INT after"
|
||||
(/ (- (System/nanoTime) start) 1e9)
|
||||
"seconds.")
|
||||
(System/exit 0))
|
||||
|
||||
(clojure.repl/set-break-handler! shutdown)
|
||||
|
||||
(doseq [i (range)]
|
||||
(prn i)
|
||||
(Thread/sleep 500))
|
||||
Loading…
Add table
Add a link
Reference in a new issue