From f1dc6bdcbef43c3fd9f109c333dfa7fc8ee8d49b Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 12 Jun 2017 22:25:57 +0100 Subject: [PATCH] Fix console queue behavior (was broken by recent changes). --- src/service.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/service.h b/src/service.h index 8b052d8..6417e55 100644 --- a/src/service.h +++ b/src/service.h @@ -871,15 +871,23 @@ class ServiceSet // Set the console queue tail (returns previous tail) void append_console_queue(ServiceRecord * newTail) noexcept { - if (! console_queue.is_queued(newTail)) { - console_queue.append(newTail); + bool was_empty = console_queue.is_empty(); + console_queue.append(newTail); + if (was_empty) { + enable_console_log(false); } } - // Retrieve the current console queue head and remove it from the queue - ServiceRecord * pull_console_queue() noexcept + // Pull and dispatch a waiter from the console queue + void pull_console_queue() noexcept { - return console_queue.pop_front(); + if (console_queue.is_empty()) { + enable_console_log(true); + } + else { + ServiceRecord * front = console_queue.pop_front(); + front->acquiredConsole(); + } } void unqueue_console(ServiceRecord * service) noexcept -- 2.25.1