Add the given thread to break-threads so that it will be stopped
any time the user presses Ctrl-C. Calls start-handling-break for
you. Adds the current thread if none is given.
(defn add-break-thread!
"Add the given thread to break-threads so that it will be stopped
any time the user presses Ctrl-C. Calls start-handling-break for
you. Adds the current thread if none is given."
([] (add-break-thread! (Thread/currentThread)))
([t]
(start-handling-break)
(let [tref (java.lang.ref.WeakReference. t)]
(swap! break-threads assoc (.getId t) tref))))
Comments top
No comments for add-break-thread!. Log in to add a comment.