From 1ccb64e18f1e4c1f51c12b9dc31a881e2829b2b6 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 6 Jun 2013 15:28:41 +0200 Subject: scheduler: Add start idle thread operation Add and use _Scheduler_Start_idle(). --- cpukit/score/src/schedulerdefaultstartidle.c | 22 ++++++++++++++++++++++ cpukit/score/src/threadcreateidle.c | 3 ++- cpukit/score/src/threadstart.c | 10 ++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 cpukit/score/src/schedulerdefaultstartidle.c (limited to 'cpukit/score/src') diff --git a/cpukit/score/src/schedulerdefaultstartidle.c b/cpukit/score/src/schedulerdefaultstartidle.c new file mode 100644 index 0000000000..043fe68b52 --- /dev/null +++ b/cpukit/score/src/schedulerdefaultstartidle.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2013 embedded brains GmbH + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include + +void _Scheduler_default_Start_idle( + Thread_Control *thread, + Per_CPU_Control *processor +) +{ + (void) processor; + _Scheduler_Unblock( thread ); +} diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index 7ad24cfdb3..d075510135 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -73,7 +73,8 @@ static void _Thread_Create_idle_for_cpu( Per_CPU_Control *per_cpu ) THREAD_START_NUMERIC, rtems_configuration_get_idle_task(), NULL, - 0 + 0, + per_cpu ); } diff --git a/cpukit/score/src/threadstart.c b/cpukit/score/src/threadstart.c index d9ce62a091..4e24f39cfc 100644 --- a/cpukit/score/src/threadstart.c +++ b/cpukit/score/src/threadstart.c @@ -38,7 +38,8 @@ bool _Thread_Start( Thread_Start_types the_prototype, void *entry_point, void *pointer_argument, - Thread_Entry_numeric_type numeric_argument + Thread_Entry_numeric_type numeric_argument, + Per_CPU_Control *processor ) { if ( _States_Is_dormant( the_thread->current_state ) ) { @@ -51,7 +52,12 @@ bool _Thread_Start( _Thread_Load_environment( the_thread ); - _Thread_Ready( the_thread ); + if ( processor == NULL ) { + _Thread_Ready( the_thread ); + } else { + the_thread->current_state = STATES_READY; + _Scheduler_Start_idle( the_thread, processor ); + } _User_extensions_Thread_start( the_thread ); -- cgit v1.2.3