summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-01 14:47:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-07-01 14:47:07 +0200
commitdf2177ab5ea1c5b183513cdcac729af9c4040110 (patch)
treec313d341042ae07b605a08055e1cd447619f38d0
parentscore: Fix MPCI message layout (diff)
downloadrtems-df2177ab5ea1c5b183513cdcac729af9c4040110.tar.bz2
score: Change scheduler node init and destroy
Provide the scheduler node to initialize or destroy to the corresponding operations. This makes it possible to have more than one scheduler node per thread.
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h9
-rw-r--r--cpukit/score/include/rtems/score/schedulercbs.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulercbsimpl.h7
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h4
-rw-r--r--cpukit/score/include/rtems/score/scheduleredfimpl.h7
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h20
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h4
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityimpl.h7
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h1
-rw-r--r--cpukit/score/include/rtems/score/schedulerstrongapa.h1
-rw-r--r--cpukit/score/src/schedulercbsnodeinit.c9
-rw-r--r--cpukit/score/src/schedulerdefaultnodedestroy.c4
-rw-r--r--cpukit/score/src/schedulerdefaultnodeinit.c3
-rw-r--r--cpukit/score/src/scheduleredfnodeinit.c8
-rw-r--r--cpukit/score/src/schedulerpriority.c11
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c20
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c13
-rw-r--r--cpukit/score/src/schedulersimplesmp.c13
-rw-r--r--cpukit/score/src/schedulerstrongapa.c13
-rw-r--r--cpukit/score/src/threadinitialize.c9
-rw-r--r--cpukit/score/src/threadrestart.c5
23 files changed, 107 insertions, 64 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 9f31d7ad1f..120fdfd239 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -130,12 +130,13 @@ typedef struct {
/** @see _Scheduler_Node_initialize() */
void ( *node_initialize )(
const Scheduler_Control *,
+ Scheduler_Node *,
Thread_Control *,
Priority_Control
);
/** @see _Scheduler_Node_destroy() */
- void ( *node_destroy )( const Scheduler_Control *, Thread_Control * );
+ void ( *node_destroy )( const Scheduler_Control *, Scheduler_Node * );
/** @see _Scheduler_Release_job() */
void ( *release_job ) (
@@ -498,11 +499,13 @@ void _Scheduler_default_Schedule(
* @brief Performs the scheduler base node initialization.
*
* @param[in] scheduler Unused.
+ * @param[in] node The node to initialize.
* @param[in] the_thread Unused.
* @param[in] priority The thread priority.
*/
void _Scheduler_default_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
@@ -511,11 +514,11 @@ void _Scheduler_default_Node_initialize(
* @brief Does nothing.
*
* @param[in] scheduler Unused.
- * @param[in] the_thread Unused.
+ * @param[in] node Unused.
*/
void _Scheduler_default_Node_destroy(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Scheduler_Node *node
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index 91e69d09da..a46314c659 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -345,6 +345,7 @@ void _Scheduler_CBS_Budget_callout(
*/
void _Scheduler_CBS_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/schedulercbsimpl.h b/cpukit/score/include/rtems/score/schedulercbsimpl.h
index ddc79fe6da..84f6b5d029 100644
--- a/cpukit/score/include/rtems/score/schedulercbsimpl.h
+++ b/cpukit/score/include/rtems/score/schedulercbsimpl.h
@@ -43,6 +43,13 @@ RTEMS_INLINE_ROUTINE Scheduler_CBS_Node *_Scheduler_CBS_Thread_get_node(
return (Scheduler_CBS_Node *) _Scheduler_Thread_get_node( the_thread );
}
+RTEMS_INLINE_ROUTINE Scheduler_CBS_Node *_Scheduler_CBS_Node_downcast(
+ Scheduler_Node *node
+)
+{
+ return (Scheduler_CBS_Node *) node;
+}
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 66bc17e203..de06344aa5 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -152,11 +152,13 @@ void _Scheduler_EDF_Schedule(
* @brief Initializes an EDF specific scheduler node of @a the_thread.
*
* @param[in] scheduler The scheduler instance.
- * @param[in] the_thread being initialized.
+ * @param[in] node being initialized.
+ * @param[in] the_thread the thread of the node.
* @param[in] priority The thread priority.
*/
void _Scheduler_EDF_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index 204660ecee..844d745d54 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -53,6 +53,13 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node(
return (Scheduler_EDF_Node *) _Scheduler_Thread_get_node( the_thread );
}
+RTEMS_INLINE_ROUTINE Scheduler_EDF_Node * _Scheduler_EDF_Node_downcast(
+ Scheduler_Node *node
+)
+{
+ return (Scheduler_EDF_Node *) node;
+}
+
RTEMS_INLINE_ROUTINE bool _Scheduler_EDF_Less(
const void *left,
const RBTree_Node *right
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 2007b30b9d..db4be99f79 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -455,17 +455,20 @@ RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Unmap_priority(
* destroyed.
*
* @param[in] scheduler The scheduler instance.
- * @param[in] the_thread The thread containing the scheduler node.
+ * @param[in] node The scheduler node to initialize.
+ * @param[in] the_thread The thread of the scheduler node to initialize.
* @param[in] priority The thread priority.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
( *scheduler->Operations.node_initialize )(
scheduler,
+ node,
the_thread,
priority
);
@@ -478,14 +481,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Node_initialize(
* after a corresponding _Scheduler_Node_initialize().
*
* @param[in] scheduler The scheduler instance.
- * @param[in] the_thread The thread containing the scheduler node.
+ * @param[in] node The scheduler node to destroy.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Node_destroy(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Scheduler_Node *node
)
{
- ( *scheduler->Operations.node_destroy )( scheduler, the_thread );
+ ( *scheduler->Operations.node_destroy )( scheduler, node );
}
/**
@@ -1464,10 +1467,15 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set(
_Scheduler_Block( the_thread );
}
- _Scheduler_Node_destroy( old_scheduler, the_thread );
+ _Scheduler_Node_destroy( old_scheduler, own_node );
the_thread->Scheduler.own_control = new_scheduler;
the_thread->Scheduler.control = new_scheduler;
- _Scheduler_Node_initialize( new_scheduler, the_thread, priority );
+ _Scheduler_Node_initialize(
+ new_scheduler,
+ own_node,
+ the_thread,
+ priority
+ );
if ( _States_Is_ready( current_state ) ) {
_Scheduler_Unblock( the_thread );
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index f2e045903e..9501e3d026 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -159,6 +159,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
void _Scheduler_priority_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 2c9b49671e..763523aec3 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -73,12 +73,14 @@ extern "C" {
* This routine allocates @a thread->scheduler.
*
* @param[in] scheduler points to the scheduler specific information.
- * @param[in] thread is the thread the scheduler is allocating
+ * @param[in] node is the node the scheduler is allocating
* management memory for.
+ * @param[in] the_thread the thread of the node.
* @param[in] priority is the thread priority.
*/
void _Scheduler_priority_affinity_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index d03c8d32dc..e33866e59b 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -48,6 +48,13 @@ RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Thread_get_nod
return (Scheduler_priority_Node *) _Scheduler_Thread_get_node( the_thread );
}
+RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_downcast(
+ Scheduler_Node *node
+)
+{
+ return (Scheduler_priority_Node *) node;
+}
+
/**
* @brief Ready queue initialization.
*
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 051e44f8af..97370ac510 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -99,6 +99,7 @@ void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
void _Scheduler_priority_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 0a05546c46..bbcdbdb03e 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -82,6 +82,7 @@ void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler );
void _Scheduler_simple_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index e2a33afed7..8390c2d3b9 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -99,6 +99,7 @@ void _Scheduler_strong_APA_Initialize( const Scheduler_Control *scheduler );
void _Scheduler_strong_APA_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
);
diff --git a/cpukit/score/src/schedulercbsnodeinit.c b/cpukit/score/src/schedulercbsnodeinit.c
index 3aa825bd12..53800693c0 100644
--- a/cpukit/score/src/schedulercbsnodeinit.c
+++ b/cpukit/score/src/schedulercbsnodeinit.c
@@ -22,14 +22,15 @@
void _Scheduler_CBS_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_CBS_Node *node;
+ Scheduler_CBS_Node *the_node;
- _Scheduler_EDF_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_EDF_Node_initialize( scheduler, node, the_thread, priority );
- node = _Scheduler_CBS_Thread_get_node( the_thread );
- node->cbs_server = NULL;
+ the_node = _Scheduler_CBS_Node_downcast( node );
+ the_node->cbs_server = NULL;
}
diff --git a/cpukit/score/src/schedulerdefaultnodedestroy.c b/cpukit/score/src/schedulerdefaultnodedestroy.c
index d1d84f366a..537c824558 100644
--- a/cpukit/score/src/schedulerdefaultnodedestroy.c
+++ b/cpukit/score/src/schedulerdefaultnodedestroy.c
@@ -23,9 +23,9 @@
void _Scheduler_default_Node_destroy(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Scheduler_Node *node
)
{
(void) scheduler;
- (void) the_thread;
+ (void) node;
}
diff --git a/cpukit/score/src/schedulerdefaultnodeinit.c b/cpukit/score/src/schedulerdefaultnodeinit.c
index de2b6c8dd3..10e71f8a05 100644
--- a/cpukit/score/src/schedulerdefaultnodeinit.c
+++ b/cpukit/score/src/schedulerdefaultnodeinit.c
@@ -23,12 +23,11 @@
void _Scheduler_default_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_Node *node = _Scheduler_Thread_get_own_node( the_thread );
-
(void) scheduler;
_Scheduler_Node_do_initialize( node, the_thread, priority );
diff --git a/cpukit/score/src/scheduleredfnodeinit.c b/cpukit/score/src/scheduleredfnodeinit.c
index 6005fa0538..bde25c18d7 100644
--- a/cpukit/score/src/scheduleredfnodeinit.c
+++ b/cpukit/score/src/scheduleredfnodeinit.c
@@ -22,15 +22,17 @@
void _Scheduler_EDF_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_EDF_Node *node = _Scheduler_EDF_Thread_get_node( the_thread );
+ Scheduler_EDF_Node *the_node;
(void) scheduler;
- _Scheduler_Node_do_initialize( &node->Base, the_thread, priority );
+ _Scheduler_Node_do_initialize( node, the_thread, priority );
- node->thread = the_thread;
+ the_node = _Scheduler_EDF_Node_downcast( node );
+ the_node->thread = the_thread;
}
diff --git a/cpukit/score/src/schedulerpriority.c b/cpukit/score/src/schedulerpriority.c
index 2719697ba3..11cee92424 100644
--- a/cpukit/score/src/schedulerpriority.c
+++ b/cpukit/score/src/schedulerpriority.c
@@ -35,19 +35,20 @@ void _Scheduler_priority_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_priority_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_priority_Context *context;
- Scheduler_priority_Node *node;
+ Scheduler_priority_Node *the_node;
- context = _Scheduler_priority_Get_context( scheduler );
- node = _Scheduler_priority_Thread_get_node( the_thread );
+ _Scheduler_Node_do_initialize( node, the_thread, priority );
- _Scheduler_Node_do_initialize( &node->Base, the_thread, priority );
+ context = _Scheduler_priority_Get_context( scheduler );
+ the_node = _Scheduler_priority_Node_downcast( node );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&context->Bit_map,
&context->Ready[ 0 ]
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index cec09729fb..e171d5e5c7 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -60,15 +60,6 @@ static bool _Scheduler_priority_affinity_SMP_Insert_priority_fifo_order(
&& _Scheduler_SMP_Insert_priority_fifo_order( to_insert, next );
}
-static Scheduler_priority_affinity_SMP_Node *
-_Scheduler_priority_affinity_SMP_Thread_get_own_node(
- Thread_Control *thread
-)
-{
- return (Scheduler_priority_affinity_SMP_Node *)
- _Scheduler_Thread_get_own_node( thread );
-}
-
/*
* This method returns the scheduler node for the specified thread
* as a scheduler specific type.
@@ -96,20 +87,21 @@ _Scheduler_priority_affinity_SMP_Node_downcast(
*/
void _Scheduler_priority_affinity_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_priority_affinity_SMP_Node *node =
- _Scheduler_priority_affinity_SMP_Thread_get_own_node( the_thread );
+ Scheduler_priority_affinity_SMP_Node *the_node;
- _Scheduler_priority_SMP_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_priority_SMP_Node_initialize( scheduler, node, the_thread, priority );
/*
* All we add is affinity information to the basic SMP node.
*/
- node->Affinity = *_CPU_set_Default();
- node->Affinity.set = &node->Affinity.preallocated;
+ the_node = _Scheduler_priority_affinity_SMP_Node_downcast( node );
+ the_node->Affinity = *_CPU_set_Default();
+ the_node->Affinity.set = &the_node->Affinity.preallocated;
}
/*
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index aba863e66a..07e7af4268 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -47,23 +47,22 @@ void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_priority_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_Context *context;
Scheduler_priority_SMP_Context *self;
- Scheduler_priority_SMP_Node *node;
+ Scheduler_priority_SMP_Node *the_node;
+
+ the_node = _Scheduler_priority_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( &the_node->Base, the_thread, priority );
context = _Scheduler_Get_context( scheduler );
self = _Scheduler_priority_SMP_Get_self( context );
- node = _Scheduler_priority_SMP_Node_downcast(
- _Scheduler_Thread_get_own_node( the_thread )
- );
-
- _Scheduler_SMP_Node_initialize( &node->Base, the_thread, priority );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&self->Bit_map,
&self->Ready[ 0 ]
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index f368ead556..8f86ea87da 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -44,26 +44,29 @@ void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_simple_SMP_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_own_node( the_thread );
+ Scheduler_SMP_Node *the_node;
- _Scheduler_SMP_Node_initialize( node, the_thread, priority );
+ the_node = _Scheduler_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( the_node, the_thread, priority );
}
static void _Scheduler_simple_SMP_Do_update(
Scheduler_Context *context,
- Scheduler_Node *node_to_update,
+ Scheduler_Node *node,
Priority_Control new_priority
)
{
- Scheduler_SMP_Node *node = _Scheduler_SMP_Node_downcast( node_to_update );
+ Scheduler_SMP_Node *the_node;
(void) context;
- _Scheduler_SMP_Node_update_priority( node, new_priority );
+ the_node = _Scheduler_SMP_Node_downcast( node );
+ _Scheduler_SMP_Node_update_priority( the_node, new_priority );
}
static Scheduler_Node *_Scheduler_simple_SMP_Get_highest_ready(
diff --git a/cpukit/score/src/schedulerstrongapa.c b/cpukit/score/src/schedulerstrongapa.c
index 14c238e550..5d7c7f7a1d 100644
--- a/cpukit/score/src/schedulerstrongapa.c
+++ b/cpukit/score/src/schedulerstrongapa.c
@@ -173,23 +173,22 @@ void _Scheduler_strong_APA_Initialize( const Scheduler_Control *scheduler )
void _Scheduler_strong_APA_Node_initialize(
const Scheduler_Control *scheduler,
+ Scheduler_Node *node,
Thread_Control *the_thread,
Priority_Control priority
)
{
Scheduler_Context *context;
Scheduler_strong_APA_Context *self;
- Scheduler_strong_APA_Node *node;
+ Scheduler_strong_APA_Node *the_node;
+
+ the_node = _Scheduler_strong_APA_Node_downcast( node );
+ _Scheduler_SMP_Node_initialize( &the_node->Base, the_thread, priority );
context = _Scheduler_Get_context( scheduler );
self = _Scheduler_strong_APA_Get_self( context );
- node = _Scheduler_strong_APA_Node_downcast(
- _Scheduler_Thread_get_own_node( the_thread )
- );
-
- _Scheduler_SMP_Node_initialize( &node->Base, the_thread, priority );
_Scheduler_priority_Ready_queue_update(
- &node->Ready_queue,
+ &the_node->Ready_queue,
priority,
&self->Bit_map,
&self->Ready[ 0 ]
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 7237cfeb75..940537f135 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -52,6 +52,7 @@ bool _Thread_Initialize(
#endif
bool extension_status;
size_t i;
+ Scheduler_Node *scheduler_node;
bool scheduler_node_initialized = false;
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( 0 );
@@ -173,11 +174,13 @@ bool _Thread_Initialize(
#endif
}
+ scheduler_node = the_thread->Scheduler.node;
+
#if defined(RTEMS_SMP)
RTEMS_STATIC_ASSERT( THREAD_SCHEDULER_BLOCKED == 0, Scheduler_state );
the_thread->Scheduler.own_control = scheduler;
the_thread->Scheduler.control = scheduler;
- the_thread->Scheduler.own_node = the_thread->Scheduler.node;
+ the_thread->Scheduler.own_node = scheduler_node;
_Resource_Node_initialize( &the_thread->Resource_node );
_Atomic_Store_uintptr(
&the_thread->Lock.current.atomic,
@@ -204,7 +207,7 @@ bool _Thread_Initialize(
RTEMS_STATIC_ASSERT( THREAD_WAIT_FLAGS_INITIAL == 0, Wait_flags );
- _Scheduler_Node_initialize( scheduler, the_thread, priority );
+ _Scheduler_Node_initialize( scheduler, scheduler_node, the_thread, priority );
scheduler_node_initialized = true;
/* POSIX Keys */
@@ -232,7 +235,7 @@ bool _Thread_Initialize(
failed:
if ( scheduler_node_initialized ) {
- _Scheduler_Node_destroy( scheduler, the_thread );
+ _Scheduler_Node_destroy( scheduler, scheduler_node );
}
_Workspace_Free( the_thread->Start.tls_area );
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 32ecfba65d..b43c019b69 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -183,7 +183,10 @@ static void _Thread_Free( Thread_Control *the_thread )
_User_extensions_Thread_delete( the_thread );
_User_extensions_Destroy_iterators( the_thread );
_ISR_lock_Destroy( &the_thread->Keys.Lock );
- _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), the_thread );
+ _Scheduler_Node_destroy(
+ _Scheduler_Get( the_thread ),
+ _Scheduler_Thread_get_own_node( the_thread )
+ );
_ISR_lock_Destroy( &the_thread->Timer.Lock );
/*