From 4956f3a342ac74da8d5e9190202b6366626b8888 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 2 Sep 2021 18:55:22 +0200 Subject: cpukit/libtest/t-test-scheduler.c --- cpukit/libtest/t-test-scheduler.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/cpukit/libtest/t-test-scheduler.c b/cpukit/libtest/t-test-scheduler.c index 096dd38353..ead879d99c 100644 --- a/cpukit/libtest/t-test-scheduler.c +++ b/cpukit/libtest/t-test-scheduler.c @@ -89,28 +89,34 @@ T_scheduler_record_event(T_scheduler_event *event) rtems_interrupt_lock_context lock_context; T_scheduler_log *log; T_scheduler_event_handler handler; + Per_CPU_Control *cpu_self; ctx = &T_scheduler_instance; - rtems_interrupt_lock_acquire_isr(&ctx->lock, &lock_context); - log = ctx->active; handler = ctx->handler; - if (log != NULL || handler != NULL) { - Per_CPU_Control *cpu_self; + if (log == NULL && handler == NULL) { + return; + } - cpu_self = _Per_CPU_Get(); + cpu_self = _Per_CPU_Get(); - if (_Per_CPU_Is_ISR_in_progress(cpu_self)) { - event->executing = NULL; - } else { - event->executing = _Per_CPU_Get_executing(cpu_self); - } - - event->cpu = _Per_CPU_Get_index(cpu_self); - event->instant = T_now(); + if (_Per_CPU_Is_ISR_in_progress(cpu_self)) { + event->executing = NULL; + } else { + event->executing = _Per_CPU_Get_executing(cpu_self); } + event->cpu = _Per_CPU_Get_index(cpu_self); + event->instant = T_now(); + + rtems_interrupt_lock_acquire_isr(&ctx->lock, &lock_context); + +#ifdef RTEMS_SMP + log = ctx->active; + handler = ctx->handler; +#endif + if (handler != NULL) { ctx->cpu = rtems_scheduler_get_processor() + 1; (*handler)(ctx->arg, event); -- cgit v1.2.3