aboutsummaryrefslogtreecommitdiffstats
path: root/src/trsync.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/trsync.c')
-rw-r--r--src/trsync.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/trsync.c b/src/trsync.c
index 3bf7aa66..5625280a 100644
--- a/src/trsync.c
+++ b/src/trsync.c
@@ -1,6 +1,6 @@
// Handling of synchronized "trigger" dispatch
//
-// Copyright (C) 2016-2021 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2016-2024 Kevin O'Connor <kevin@koconnor.net>
//
// This file may be distributed under the terms of the GNU GPLv3 license.
@@ -23,13 +23,14 @@ enum { TSF_CAN_TRIGGER=1<<0, TSF_REPORT=1<<2 };
static struct task_wake trsync_wake;
-// Activate a trigger (caller must disable IRQs)
+// Activate a trigger
void
trsync_do_trigger(struct trsync *ts, uint8_t reason)
{
+ irqstatus_t flag = irq_save();
uint8_t flags = ts->flags;
if (!(flags & TSF_CAN_TRIGGER))
- return;
+ goto done;
ts->trigger_reason = reason;
ts->flags = (flags & ~TSF_CAN_TRIGGER) | TSF_REPORT;
// Dispatch signals
@@ -42,6 +43,8 @@ trsync_do_trigger(struct trsync *ts, uint8_t reason)
func(tss, reason);
}
sched_wake_task(&trsync_wake);
+done:
+ irq_restore(flag);
}
// Timeout handler