From: Davin McCall Date: Mon, 12 Jun 2017 21:25:57 +0000 (+0100) Subject: Fix console queue behavior (was broken by recent changes). X-Git-Tag: v0.06~74 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f1dc6bdcbef43c3fd9f109c333dfa7fc8ee8d49b;p=oweals%2Fdinit.git Fix console queue behavior (was broken by recent changes). --- 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