summaryrefslogtreecommitdiff
path: root/kern/log.c
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-06-11 11:44:13 +0200
committerRichard Braun <rbraun@sceen.net>2017-06-11 11:44:13 +0200
commit61df7f19dfe3b56abf6c4d00589414c60716ac2b (patch)
treed13ab48464b9d28ae12aba84b6bc3f083226400a /kern/log.c
parentb135fef80cf8f9addf5725881a2fe81cda404dfe (diff)
kern/log: serialize the start of the log and shell threads
Diffstat (limited to 'kern/log.c')
-rw-r--r--kern/log.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kern/log.c b/kern/log.c
index 6adc378b..a3b34f37 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -228,11 +228,13 @@ log_run(void *arg)
{
unsigned long flags, index, nr_overruns;
struct log_record record;
+ bool start_shell;
int error;
(void)arg;
nr_overruns = 0;
+ start_shell = true;
spinlock_lock_intr_save(&log_lock, &flags);
@@ -240,6 +242,16 @@ log_run(void *arg)
for (;;) {
while (index == cbuf_end(&log_cbuf)) {
+ /*
+ * Starting the shell after the log thread sleeps for the first
+ * time cleanly serializes log messages and shell prompt, making
+ * a clean ordered output.
+ */
+ if (start_shell) {
+ shell_start();
+ start_shell = false;
+ }
+
thread_sleep(&log_lock, &log_cbuf, "log_cbuf");
}