diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 8c29e471ebf..ac17b3460b6 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -559,6 +559,8 @@ void _assert(FAR const char *filename, int linenum, flags = enter_critical_section(); + sched_lock(); + /* try to save current context if regs is null */ if (regs == NULL) @@ -680,5 +682,7 @@ void _assert(FAR const char *filename, int linenum, #endif } + sched_unlock(); + leave_critical_section(flags); }