summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2019-05-26 17:34:18 +0200
committerRichard Braun <rbraun@sceen.net>2019-05-26 17:34:18 +0200
commitd44f65873b1a00f450346ac9506bcc65ecc2c5d5 (patch)
tree17b24a7b3b42075dce809bde85b87d26051c367a
parent5bc2263b54a89e28dd5092c807a86cd3c078e4d3 (diff)
kern/log: fix bulletin publication
-rw-r--r--kern/log.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kern/log.c b/kern/log.c
index 2d2206ca..d2970cf4 100644
--- a/kern/log.c
+++ b/kern/log.c
@@ -55,7 +55,6 @@ static char log_buffer[LOG_BUFFER_SIZE];
static unsigned int log_nr_overruns;
-static bool log_bulletin_published;
static struct bulletin log_bulletin;
/*
@@ -146,9 +145,12 @@ log_run(void *arg)
{
struct log_consumer ctx;
unsigned long flags;
+ bool published;
(void)arg;
+ published = false;
+
spinlock_lock_intr_save(&log_lock, &flags);
log_consumer_init(&ctx, &log_mbuf);
@@ -172,9 +174,12 @@ log_run(void *arg)
break;
}
- if (!log_bulletin_published) {
+ if (!published) {
+ spinlock_unlock_intr_restore(&log_lock, flags);
bulletin_publish(&log_bulletin, 0);
- log_bulletin_published = true;
+ spinlock_lock_intr_save(&log_lock, &flags);
+
+ published = true;
}
thread_sleep(&log_lock, &log_mbuf, "log_mbuf");