From 40128dbd75d38542e7929dcf90e4bb7775ac7b89 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 29 Apr 2014 11:43:03 +0200 Subject: [PATCH] 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. --- src/monitor.lisp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/monitor.lisp b/src/monitor.lisp index 2d97a98..1a2ad3a 100644 --- a/src/monitor.lisp +++ b/src/monitor.lisp @@ -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*."