(defvar *irc-listener-thread* nil) (defun start () (stop) (handler-case (lojban-dot:restart-lojban-dot) (sb-bsd-sockets:address-in-use-error () nil )) (handler-case (jbominji:start-jbominji) (t () nil )) (handler-case (jbominji-weblog:restart-jbominji-weblog) (sb-bsd-sockets:address-in-use-error () nil )) (handler-case (setf *irc-listener-thread* (sb-thread:make-thread #'jbominji-irc:irc-listen-loop :name "jbominji-irc")) (sb-bsd-sockets:try-again-error () (format t "host name lookup failure"))) ) (defun stop () (handler-case (araneida:stop-listening lojban-dot:*listener*) (t () nil)) (handler-case (araneida:stop-listening jbominji-weblog:*listener*) (t () nil)) (handler-case (handler-case (when (not (null *irc-listener-thread*)) (handler-case (jbominji-irc:quit-irc) (sb-int:simple-stream-error () nil) (simple-error () nil) (type-error () nil) ) (sb-thread:terminate-thread *irc-listener-thread*) (setf *irc-listener-thread* nil)) (sb-thread:interrupt-thread-error () nil) ) (unbound-variable () nil) (sb-bsd-sockets:try-again-error () (format t "host name lookup failure")) ) (handler-case (loop for th in (sb-thread:list-all-threads) do (if (equal (sb-thread:thread-name th) "jbominji-irc") (sb-thread:terminate-thread th))) (t () nil)) )