From 05ca53ddf6bc8333c2f3ad861c5415467c3262d2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 31 Oct 2016 13:08:33 +0100 Subject: rtems: Add scheduler processor add/remove Update #2797. --- cpukit/score/src/schedulersimplesmp.c | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'cpukit/score/src/schedulersimplesmp.c') diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c index 392d4ff78a..221fcc3df5 100644 --- a/cpukit/score/src/schedulersimplesmp.c +++ b/cpukit/score/src/schedulersimplesmp.c @@ -69,6 +69,14 @@ static void _Scheduler_simple_SMP_Do_update( _Scheduler_SMP_Node_update_priority( smp_node, new_priority ); } +static bool _Scheduler_simple_SMP_Has_ready( Scheduler_Context *context ) +{ + Scheduler_simple_SMP_Context *self = + _Scheduler_simple_SMP_Get_self( context ); + + return !_Chain_Is_empty( &self->Ready ); +} + static Scheduler_Node *_Scheduler_simple_SMP_Get_highest_ready( Scheduler_Context *context, Scheduler_Node *node @@ -379,6 +387,36 @@ void _Scheduler_simple_SMP_Withdraw_node( ); } +void _Scheduler_simple_SMP_Add_processor( + const Scheduler_Control *scheduler, + Thread_Control *idle +) +{ + Scheduler_Context *context = _Scheduler_Get_context( scheduler ); + + _Scheduler_SMP_Add_processor( + context, + idle, + _Scheduler_simple_SMP_Has_ready, + _Scheduler_simple_SMP_Enqueue_scheduled_fifo + ); +} + +Thread_Control *_Scheduler_simple_SMP_Remove_processor( + const Scheduler_Control *scheduler, + Per_CPU_Control *cpu +) +{ + Scheduler_Context *context = _Scheduler_Get_context( scheduler ); + + return _Scheduler_SMP_Remove_processor( + context, + cpu, + _Scheduler_simple_SMP_Extract_from_ready, + _Scheduler_simple_SMP_Enqueue_fifo + ); +} + bool _Scheduler_simple_SMP_Yield( const Scheduler_Control *scheduler, Thread_Control *thread, -- cgit v1.2.3