Fix with-monitor support of :start-logger option.

It used to still launch an extra set of threads for monitoring where,
and that would confuse CCL where it's not possible to write into a
stream from more than one thread concurrently.
This commit is contained in:
Dimitri Fontaine 2014-04-29 11:43:03 +02:00
parent 0f62751a3f
commit 40128dbd75

View File

@ -64,12 +64,16 @@
(defmacro with-monitor ((&key (start-logger t)) &body body)
"Start and stop the monitor around BODY code. The monitor is responsible
for processing logs into a central logfile"
`(let* ((*monitoring-queue* (lq:make-queue))
(*monitoring-channel* (start-monitor :start-logger ,start-logger)))
(unwind-protect
,@body
(stop-monitor :channel *monitoring-channel*
:stop-logger ,start-logger))))
`(if ,start-logger
(let* ((*monitoring-queue* (lq:make-queue))
(*monitoring-channel* (start-monitor :start-logger ,start-logger)))
(unwind-protect
,@body
(stop-monitor :channel *monitoring-channel*
:stop-logger ,start-logger)))
;; logger has already been started
(progn ,@body)))
(defun monitor (queue)
"Receives and process messages from *monitoring-queue*."