diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-12 12:12:21 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-19 08:44:23 +0100 |
commit | 4b4a34a6139a8154e76166698ec6b90252981c50 (patch) | |
tree | f7991ced221a35fd6cd023e17f7dcff5c639a606 | |
parent | 389322763a1edd367fa17e7ea1469d096829fa4f (diff) |
testsuites/validation/tc-sched-smp.c
-rw-r--r-- | testsuites/validation/tc-sched-smp.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/testsuites/validation/tc-sched-smp.c b/testsuites/validation/tc-sched-smp.c index c617c212dc..483a5d475f 100644 --- a/testsuites/validation/tc-sched-smp.c +++ b/testsuites/validation/tc-sched-smp.c @@ -237,6 +237,11 @@ typedef struct { volatile bool busy[ WORKER_COUNT ];; /** + * @brief If this member is true, then the worker shall be in the busy loop. + */ + volatile bool is_busy[ WORKER_COUNT ];; + + /** * @brief This member contains the per-CPU jobs. */ Per_CPU_Job job[ 2 ]; @@ -275,10 +280,18 @@ static void SendAndSync( Context *ctx, WorkerIndex worker, Event event ) static void MakeBusy( Context *ctx, WorkerIndex worker ) { + ctx->is_busy[ worker ] = false; ctx->busy[ worker ] = true; SendEvents( ctx->worker_id[ worker ], EVENT_BUSY ); } +static void WaitForBusy( Context *ctx, WorkerIndex worker ) +{ + while ( !ctx->is_busy[ worker ] ) { + /* Wait */ + } +} + static void StopBusy( Context *ctx, WorkerIndex worker ) { ctx->busy[ worker ] = false; @@ -645,9 +658,13 @@ static void Worker( rtems_task_argument arg, WorkerIndex worker ) } if ( ( events & EVENT_BUSY ) != 0 ) { + ctx->is_busy[ worker ] = true; + while ( ctx->busy[ worker ] ) { /* Wait */ } + + ctx->is_busy[ worker ] = false; } } } @@ -747,8 +764,9 @@ static void ScoreSchedSmpValSmp_Action_0( ScoreSchedSmpValSmp_Context *ctx ) SendAndSync( ctx, WORKER_B, EVENT_OBTAIN ); SetScheduler( ctx->worker_id[ WORKER_C ], SCHEDULER_B_ID, PRIO_HIGH ); SetPriority( ctx->worker_id[ WORKER_A ], PRIO_NORMAL ); - SendAndSync( ctx, WORKER_A, EVENT_STICKY_OBTAIN ); + SendEvents( ctx->worker_id[ WORKER_A ], EVENT_STICKY_OBTAIN ); MakeBusy( ctx, WORKER_A ); + WaitForBusy( ctx, WORKER_A ); /* * Reschedule worker A by the home scheduler while worker A is not scheduled |