diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-12 17:47:28 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-12 17:48:22 +0200 |
commit | d8909103c4f28aa592efefbb77b3fd5d9dfbb421 (patch) | |
tree | 097bf393f297d0a5f9f25f225f97072142c0ce0d | |
parent | 5592bc8273be668b52b97233dd5125e53d65924a (diff) |
validation: Fix event send/receivequal-4
-rw-r--r-- | testsuites/validation/tr-event-send-receive.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/testsuites/validation/tr-event-send-receive.c b/testsuites/validation/tr-event-send-receive.c index e5e672dbbe..0dc6ed51d1 100644 --- a/testsuites/validation/tr-event-send-receive.c +++ b/testsuites/validation/tr-event-send-receive.c @@ -433,8 +433,9 @@ static void Worker( rtems_task_argument arg ) ctx = (Context *) arg; while ( true ) { - rtems_status_code sc; - rtems_task_priority prio; + rtems_status_code sc; + rtems_task_priority prio; + T_thread_switch_log *log; Wait( ctx->worker_wakeup ); @@ -447,12 +448,26 @@ static void Worker( rtems_task_argument arg ) T_eq_u32( prio, PRIO_LOW ); break; case PRIO_OTHER: + log = T_thread_switch_record_4( &ctx->thread_switch_log ); + T_null( log ); sc = rtems_task_set_scheduler( RTEMS_SELF, ctx->other_sched, PRIO_LOW ); T_rsc_success( sc ); + + /* + * Make sure the context switch to the IDLE thread on the previous + * CPU is recorded, otherwise the preemption check may sporadically + * fail on some targets. + */ + while (ctx->thread_switch_log.log.recorded < 2) { + RTEMS_COMPILER_MEMORY_BARRIER(); + } + + log = T_thread_switch_record( NULL ); + T_eq_ptr( log, &ctx->thread_switch_log.log ); break; case PRIO_LOW: break; |