[rtems commit] score: Move _Thread_Scheduler_ask_for_help()
Sebastian Huber
sebh at rtems.org
Fri Feb 3 09:58:09 UTC 2017
Module: rtems
Branch: master
Commit: bbfbfc847e07ab98f47104a70e72033468eaedcc
Changeset: http://git.rtems.org/rtems/commit/?id=bbfbfc847e07ab98f47104a70e72033468eaedcc
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Feb 3 08:57:18 2017 +0100
score: Move _Thread_Scheduler_ask_for_help()
Move _Thread_Scheduler_ask_for_help(), rename it to
_Thread_Ask_for_help() and make it static.
---
cpukit/score/include/rtems/score/threadimpl.h | 2 --
cpukit/score/src/threaddispatch.c | 35 ++++++++++++++++++++++++++-
cpukit/score/src/threadscheduler.c | 33 -------------------------
3 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 8ddf74e..b2263a1 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -1098,8 +1098,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_release_critical(
}
#if defined(RTEMS_SMP)
-void _Thread_Scheduler_ask_for_help( Thread_Control *the_thread );
-
void _Thread_Scheduler_process_requests( Thread_Control *the_thread );
#endif
diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c
index 5fe0843..a68e3c1 100644
--- a/cpukit/score/src/threaddispatch.c
+++ b/cpukit/score/src/threaddispatch.c
@@ -41,6 +41,39 @@ Thread_Control *_Thread_Allocated_fp;
CHAIN_DEFINE_EMPTY( _User_extensions_Switches_list );
#if defined(RTEMS_SMP)
+static void _Thread_Ask_for_help( Thread_Control *the_thread )
+{
+ Chain_Node *node;
+ const Chain_Node *tail;
+
+ node = _Chain_First( &the_thread->Scheduler.Scheduler_nodes );
+ tail = _Chain_Immutable_tail( &the_thread->Scheduler.Scheduler_nodes );
+
+ do {
+ Scheduler_Node *scheduler_node;
+ const Scheduler_Control *scheduler;
+ ISR_lock_Context lock_context;
+ bool success;
+
+ scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node );
+ scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
+
+ _Scheduler_Acquire_critical( scheduler, &lock_context );
+ success = ( *scheduler->Operations.ask_for_help )(
+ scheduler,
+ the_thread,
+ scheduler_node
+ );
+ _Scheduler_Release_critical( scheduler, &lock_context );
+
+ if ( success ) {
+ break;
+ }
+
+ node = _Chain_Next( node );
+ } while ( node != tail );
+}
+
static bool _Thread_Can_ask_for_help( const Thread_Control *executing )
{
return executing->Scheduler.helping_nodes > 0
@@ -64,7 +97,7 @@ static void _Thread_Preemption_intervention( Per_CPU_Control *cpu_self )
_Per_CPU_Release( cpu_self );
_Thread_State_acquire( the_thread, &lock_context );
- _Thread_Scheduler_ask_for_help( the_thread );
+ _Thread_Ask_for_help( the_thread );
_Thread_State_release( the_thread, &lock_context );
_Per_CPU_Acquire( cpu_self );
}
diff --git a/cpukit/score/src/threadscheduler.c b/cpukit/score/src/threadscheduler.c
index b0cf571..d6918b1 100644
--- a/cpukit/score/src/threadscheduler.c
+++ b/cpukit/score/src/threadscheduler.c
@@ -20,39 +20,6 @@
#include <rtems/score/schedulerimpl.h>
#if defined(RTEMS_SMP)
-void _Thread_Scheduler_ask_for_help( Thread_Control *the_thread )
-{
- Chain_Node *node;
- const Chain_Node *tail;
-
- node = _Chain_First( &the_thread->Scheduler.Scheduler_nodes );
- tail = _Chain_Immutable_tail( &the_thread->Scheduler.Scheduler_nodes );
-
- do {
- Scheduler_Node *scheduler_node;
- const Scheduler_Control *scheduler;
- ISR_lock_Context lock_context;
- bool success;
-
- scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node );
- scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
-
- _Scheduler_Acquire_critical( scheduler, &lock_context );
- success = ( *scheduler->Operations.ask_for_help )(
- scheduler,
- the_thread,
- scheduler_node
- );
- _Scheduler_Release_critical( scheduler, &lock_context );
-
- if ( success ) {
- break;
- }
-
- node = _Chain_Next( node );
- } while ( node != tail );
-}
-
void _Thread_Scheduler_process_requests( Thread_Control *the_thread )
{
ISR_lock_Context lock_context;
More information about the vc
mailing list