if (onstart_flags.runs_on_console) {
tcsetpgrp(0, getpgrp());
discard_console_log_buffer();
- releaseConsole();
+ release_console();
}
force_stop = false;
{
if (onstart_flags.starts_on_console && ! has_console) {
waiting_for_deps = true;
- queueForConsole();
+ queue_for_console();
return;
}
{
if (service_state != ServiceState::STARTING) {
// We got the console but no longer want it.
- releaseConsole();
+ release_console();
}
else if (startCheckDependencies(false)) {
allDepsStarted(true);
}
else {
// We got the console but can't use it yet.
- releaseConsole();
+ release_console();
}
}
{
if (onstart_flags.starts_on_console && ! onstart_flags.runs_on_console) {
tcsetpgrp(0, getpgrp());
- releaseConsole();
+ release_console();
}
logServiceStarted(service_name);
{
if (!depfailed && onstart_flags.starts_on_console) {
tcsetpgrp(0, getpgrp());
- releaseConsole();
+ release_console();
}
logServiceFailed(service_name);
}
}
-void ServiceRecord::queueForConsole() noexcept
+void ServiceRecord::queue_for_console() noexcept
{
service_set->append_console_queue(this);
}
-void ServiceRecord::releaseConsole() noexcept
+void ServiceRecord::release_console() noexcept
{
service_set->pullConsoleQueue();
}
}
// Queue to run on the console. 'acquiredConsole()' will be called when the console is available.
- void queueForConsole() noexcept;
+ // Has no effect if the service has already queued for console.
+ void queue_for_console() noexcept;
// Release console (console must be currently held by this service)
- void releaseConsole() noexcept;
+ void release_console() noexcept;
bool do_auto_restart() noexcept;
}
// Set the console queue tail (returns previous tail)
- ServiceRecord * append_console_queue(ServiceRecord * newTail) noexcept
+ void append_console_queue(ServiceRecord * newTail) noexcept
{
- auto prev_tail = console_queue.tail();
- console_queue.append(newTail);
- return prev_tail;
+ if (! console_queue.is_queued(newTail)) {
+ console_queue.append(newTail);
+ }
}
// Retrieve the current console queue head and remove it from the queue