Skip to content

Commit

Permalink
Add a bit more robustness when starting/killing hierarchy watcher thread
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Mikhanosha committed May 28, 2013
1 parent 26f358e commit 265673e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/watcher.lisp
Expand Up @@ -43,7 +43,7 @@
(%without-interrupts
(when (with-hierarchies-lock
(cond (*watcher-thread*
(%allow-with-interrupts
(%with-local-interrupts
(log-debug "Watcher thread already started")
nil))
(t (setq *watcher-thread* (bt:current-thread)))))
Expand All @@ -60,7 +60,7 @@
(log-error :logger logger "Error in hierarchy watcher thread:~%~A" e))))
(with-hierarchies-lock
(setf *watcher-thread* nil))
(%allow-with-interrupts (log-info :logger logger "Hierarchy watcher thread ended"))))))
(%with-local-interrupts (log-info :logger logger "Hierarchy watcher thread ended"))))))
:name "Hierarchy Watcher"
:initial-bindings
`((*hierarchy* . 0)
Expand Down Expand Up @@ -92,7 +92,7 @@
(defun stop-hierarchy-watcher-thread ()
(let ((thread (with-hierarchies-lock *watcher-thread*)))
(when thread
(bt::destroy-thread thread)
(ignore-errors (bt::destroy-thread thread))
(ignore-errors (bt:join-thread thread)))))

(defun maybe-start-watcher-thread ()
Expand Down

0 comments on commit 265673e

Please sign in to comment.