[PATCH 1/2] score: Replace _Scheduler_Allocate/Free()
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Jun 3 14:31:51 UTC 2014
Replace _Scheduler_Allocate() with _Scheduler_Node_initialize(). Remove
the return status and thus the node initialization must be always
successful.
Rename _Scheduler_Free() to _Scheduler_Node_destroy().
---
cpukit/score/Makefile.am | 7 ++-
cpukit/score/include/rtems/score/scheduler.h | 16 +++----
cpukit/score/include/rtems/score/schedulercbs.h | 13 ++----
cpukit/score/include/rtems/score/scheduleredf.h | 13 ++----
cpukit/score/include/rtems/score/schedulerimpl.h | 30 +++++++++-----
.../score/include/rtems/score/schedulerpriority.h | 4 +-
.../rtems/score/schedulerpriorityaffinitysmp.h | 6 +-
.../include/rtems/score/schedulerprioritysmp.h | 6 +-
cpukit/score/include/rtems/score/schedulersimple.h | 4 +-
.../score/include/rtems/score/schedulersimplesmp.h | 6 +-
cpukit/score/src/schedulercbsallocate.c | 37 -----------------
cpukit/score/src/schedulercbsnodeinit.c | 35 ++++++++++++++++
cpukit/score/src/schedulerdefaultallocatefree.c | 42 --------------------
cpukit/score/src/schedulerdefaultnodedestroy.c | 31 ++++++++++++++
cpukit/score/src/schedulerdefaultnodeinit.c | 31 ++++++++++++++
cpukit/score/src/scheduleredfallocate.c | 36 -----------------
cpukit/score/src/scheduleredfnodeinit.c | 34 ++++++++++++++++
cpukit/score/src/schedulerpriorityaffinitysmp.c | 4 +-
cpukit/score/src/schedulerprioritysmp.c | 4 +-
cpukit/score/src/schedulersimplesmp.c | 4 +-
cpukit/score/src/threadinitialize.c | 12 ++---
cpukit/score/src/threadrestart.c | 2 +-
22 files changed, 192 insertions(+), 185 deletions(-)
delete mode 100644 cpukit/score/src/schedulercbsallocate.c
create mode 100644 cpukit/score/src/schedulercbsnodeinit.c
delete mode 100644 cpukit/score/src/schedulerdefaultallocatefree.c
create mode 100644 cpukit/score/src/schedulerdefaultnodedestroy.c
create mode 100644 cpukit/score/src/schedulerdefaultnodeinit.c
delete mode 100644 cpukit/score/src/scheduleredfallocate.c
create mode 100644 cpukit/score/src/scheduleredfnodeinit.c
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 70760c5..feb757d 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -204,7 +204,8 @@ libscore_a_SOURCES += src/log2table.c
libscore_a_SOURCES += src/scheduler.c
libscore_a_SOURCES += src/schedulergetaffinity.c
libscore_a_SOURCES += src/schedulersetaffinity.c
-libscore_a_SOURCES += src/schedulerdefaultallocatefree.c
+libscore_a_SOURCES += src/schedulerdefaultnodedestroy.c
+libscore_a_SOURCES += src/schedulerdefaultnodeinit.c
libscore_a_SOURCES += src/schedulerdefaultreleasejob.c
libscore_a_SOURCES += src/schedulerdefaultschedule.c
libscore_a_SOURCES += src/schedulerdefaultstartidle.c
@@ -231,7 +232,7 @@ libscore_a_SOURCES += src/schedulersimple.c \
## SCHEDULEREDF_C_FILES
libscore_a_SOURCES += src/scheduleredf.c \
- src/scheduleredfallocate.c \
+ src/scheduleredfnodeinit.c \
src/scheduleredfblock.c \
src/scheduleredfchangepriority.c \
src/scheduleredfprioritycompare.c \
@@ -243,7 +244,7 @@ libscore_a_SOURCES += src/scheduleredf.c \
## SCHEDULERCBS_C_FILES
libscore_a_SOURCES += src/schedulercbs.c \
- src/schedulercbsallocate.c \
+ src/schedulercbsnodeinit.c \
src/schedulercbsattachthread.c \
src/schedulercbscleanup.c \
src/schedulercbscreateserver.c \
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index c4bd350..7ca2133 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -71,11 +71,11 @@ typedef struct {
bool
);
- /** @see _Scheduler_Allocate() */
- bool ( *allocate )( const Scheduler_Control *, Thread_Control * );
+ /** @see _Scheduler_Node_initialize() */
+ void ( *node_initialize )( const Scheduler_Control *, Thread_Control * );
- /** @see _Scheduler_Free() */
- void ( *free )( const Scheduler_Control *, Thread_Control * );
+ /** @see _Scheduler_Node_destroy() */
+ void ( *node_destroy )( const Scheduler_Control *, Thread_Control * );
/** @see _Scheduler_Update() */
void ( *update )( const Scheduler_Control *, Thread_Control * );
@@ -251,14 +251,12 @@ void _Scheduler_default_Schedule(
);
/**
- * @brief Returns true.
+ * @brief Does nothing.
*
* @param[in] scheduler Unused.
* @param[in] the_thread Unused.
- *
- * @retval true Always.
*/
-bool _Scheduler_default_Allocate(
+void _Scheduler_default_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -269,7 +267,7 @@ bool _Scheduler_default_Allocate(
* @param[in] scheduler Unused.
* @param[in] the_thread Unused.
*/
-void _Scheduler_default_Free(
+void _Scheduler_default_Node_destroy(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index 46db8e5..23e528d 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -53,8 +53,8 @@ extern "C" {
_Scheduler_EDF_Block, /* block entry point */ \
_Scheduler_CBS_Unblock, /* unblock entry point */ \
_Scheduler_EDF_Change_priority, /* change priority entry point */ \
- _Scheduler_CBS_Allocate, /* allocate entry point */ \
- _Scheduler_default_Free, /* free entry point */ \
+ _Scheduler_CBS_Node_initialize, /* node initialize entry point */ \
+ _Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Update, /* update entry point */ \
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_CBS_Release_job, /* new period of task */ \
@@ -335,14 +335,9 @@ void _Scheduler_CBS_Budget_callout(
);
/**
- * @brief Allocates CBS specific information of @a the_thread.
- *
- * This routine allocates CBS specific information of @a the_thread.
- *
- * @param[in] the_thread is the thread the scheduler is allocating
- * management memory for.
+ * @brief Initializes a CBS specific scheduler node of @a the_thread.
*/
-bool _Scheduler_CBS_Allocate(
+void _Scheduler_CBS_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 301940c..a7ed88d 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -46,8 +46,8 @@ extern "C" {
_Scheduler_EDF_Block, /* block entry point */ \
_Scheduler_EDF_Unblock, /* unblock entry point */ \
_Scheduler_EDF_Change_priority, /* change priority entry point */ \
- _Scheduler_EDF_Allocate, /* allocate entry point */ \
- _Scheduler_default_Free, /* free entry point */ \
+ _Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
+ _Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Update, /* update entry point */ \
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_EDF_Release_job, /* new period of task */ \
@@ -146,14 +146,9 @@ void _Scheduler_EDF_Schedule(
);
/**
- * @brief Allocates EDF specific information of @a the_thread.
- *
- * This routine allocates EDF specific information of @a the_thread.
- *
- * @param[in] the_thread is the thread the scheduler is allocating
- * management memory for.
+ * @brief Initializes an EDF specific scheduler node of @a the_thread.
*/
-bool _Scheduler_EDF_Allocate(
+void _Scheduler_EDF_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index f1acf32..5e7c928 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -173,29 +173,39 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority(
}
/**
- * @brief Scheduler allocate.
+ * @brief Initializes a scheduler node.
*
- * This routine allocates @a the_thread->scheduler
+ * The scheduler node contains arbitrary data on function entry. The caller
+ * must ensure that _Scheduler_Node_destroy() will be called after a
+ * _Scheduler_Node_initialize() before the memory of the scheduler node is
+ * destroyed.
+ *
+ * @param[in] scheduler The scheduler instance.
+ * @param[in] the_thread The thread containing the scheduler node.
*/
-RTEMS_INLINE_ROUTINE bool _Scheduler_Allocate(
+RTEMS_INLINE_ROUTINE void _Scheduler_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- return ( *scheduler->Operations.allocate )( scheduler, the_thread );
+ return ( *scheduler->Operations.node_initialize )( scheduler, the_thread );
}
/**
- * @brief Scheduler free.
+ * @brief Destroys a scheduler node.
*
- * This routine frees @a the_thread->scheduler
+ * The caller must ensure that _Scheduler_Node_destroy() will be called only
+ * after a corresponding _Scheduler_Node_initialize().
+ *
+ * @param[in] scheduler The scheduler instance.
+ * @param[in] the_thread The thread containing the scheduler node.
*/
-RTEMS_INLINE_ROUTINE void _Scheduler_Free(
+RTEMS_INLINE_ROUTINE void _Scheduler_Node_destroy(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- ( *scheduler->Operations.free )( scheduler, the_thread );
+ ( *scheduler->Operations.node_destroy )( scheduler, the_thread );
}
/**
@@ -354,9 +364,9 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Set(
if ( current_scheduler != scheduler ) {
_Thread_Set_state( the_thread, STATES_MIGRATING );
- _Scheduler_Free( current_scheduler, the_thread );
+ _Scheduler_Node_destroy( current_scheduler, the_thread );
the_thread->scheduler = scheduler;
- _Scheduler_Allocate( scheduler, the_thread );
+ _Scheduler_Node_initialize( scheduler, the_thread );
_Scheduler_Update( scheduler, the_thread );
_Thread_Clear_state( the_thread, STATES_MIGRATING );
}
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index b3c1466..3f18f54 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -53,8 +53,8 @@ extern "C" {
_Scheduler_priority_Block, /* block entry point */ \
_Scheduler_priority_Unblock, /* unblock entry point */ \
_Scheduler_priority_Change_priority, /* change priority entry point */ \
- _Scheduler_default_Allocate, /* allocate entry point */ \
- _Scheduler_default_Free, /* free entry point */ \
+ _Scheduler_default_Node_initialize, /* node initialize entry point */ \
+ _Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_priority_Update, /* update entry point */ \
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 55271dc..ab35704 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -55,8 +55,8 @@ extern "C" {
_Scheduler_priority_SMP_Block, \
_Scheduler_priority_SMP_Unblock, \
_Scheduler_priority_SMP_Change_priority, \
- _Scheduler_priority_affinity_SMP_Allocate, \
- _Scheduler_default_Free, \
+ _Scheduler_priority_affinity_SMP_Node_initialize, \
+ _Scheduler_default_Node_destroy, \
_Scheduler_priority_SMP_Update, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
@@ -75,7 +75,7 @@ extern "C" {
* @param[in] the_thread is the thread the scheduler is allocating
* management memory for.
*/
-bool _Scheduler_priority_affinity_SMP_Allocate(
+void _Scheduler_priority_affinity_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 1030b9f..c17fcf4 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -84,8 +84,8 @@ typedef struct {
_Scheduler_priority_SMP_Block, \
_Scheduler_priority_SMP_Unblock, \
_Scheduler_priority_SMP_Change_priority, \
- _Scheduler_priority_SMP_Allocate, \
- _Scheduler_default_Free, \
+ _Scheduler_priority_SMP_Node_initialize, \
+ _Scheduler_default_Node_destroy, \
_Scheduler_priority_SMP_Update, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
@@ -97,7 +97,7 @@ typedef struct {
void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
-bool _Scheduler_priority_SMP_Allocate(
+void _Scheduler_priority_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *thread
);
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 6b59a0a..9fc2d31 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -43,8 +43,8 @@ extern "C" {
_Scheduler_simple_Block, /* block entry point */ \
_Scheduler_simple_Unblock, /* unblock entry point */ \
_Scheduler_simple_Change_priority, /* change priority entry point */ \
- _Scheduler_default_Allocate, /* allocate entry point */ \
- _Scheduler_default_Free, /* free entry point */ \
+ _Scheduler_default_Node_initialize, /* node initialize entry point */ \
+ _Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_default_Update, /* update entry point */ \
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 6c4d421..6ab1dd2 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -65,8 +65,8 @@ typedef struct {
_Scheduler_simple_SMP_Block, \
_Scheduler_simple_SMP_Unblock, \
_Scheduler_simple_SMP_Change_priority, \
- _Scheduler_simple_SMP_Allocate, \
- _Scheduler_default_Free, \
+ _Scheduler_simple_SMP_Node_initialize, \
+ _Scheduler_default_Node_destroy, \
_Scheduler_default_Update, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
@@ -78,7 +78,7 @@ typedef struct {
void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler );
-bool _Scheduler_simple_SMP_Allocate(
+void _Scheduler_simple_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/src/schedulercbsallocate.c b/cpukit/score/src/schedulercbsallocate.c
deleted file mode 100644
index 6a29088..0000000
--- a/cpukit/score/src/schedulercbsallocate.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * @file
- *
- * @brief Scheduler CBS Allocate
- * @ingroup ScoreScheduler
- */
-
-/*
- * Copyright (C) 2011 Petr Benes.
- * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/schedulercbsimpl.h>
-
-bool _Scheduler_CBS_Allocate(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread
-)
-{
- Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread );
-
- (void) scheduler;
-
- node->Base.thread = the_thread;
- node->Base.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
- node->cbs_server = NULL;
-
- return true;
-}
diff --git a/cpukit/score/src/schedulercbsnodeinit.c b/cpukit/score/src/schedulercbsnodeinit.c
new file mode 100644
index 0000000..b76380f
--- /dev/null
+++ b/cpukit/score/src/schedulercbsnodeinit.c
@@ -0,0 +1,35 @@
+/*
+ * @file
+ *
+ * @brief Scheduler CBS Allocate
+ * @ingroup ScoreScheduler
+ */
+
+/*
+ * Copyright (C) 2011 Petr Benes.
+ * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/schedulercbsimpl.h>
+
+void _Scheduler_CBS_Node_initialize(
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
+{
+ Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread );
+
+ (void) scheduler;
+
+ node->Base.thread = the_thread;
+ node->Base.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
+ node->cbs_server = NULL;
+}
diff --git a/cpukit/score/src/schedulerdefaultallocatefree.c b/cpukit/score/src/schedulerdefaultallocatefree.c
deleted file mode 100644
index c865385..0000000
--- a/cpukit/score/src/schedulerdefaultallocatefree.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file
- *
- * @brief Scheduler Default Allocate and Release Operation
- *
- * @ingroup ScoreScheduler
- */
-
-/*
- * COPYRIGHT (c) 2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/scheduler.h>
-
-bool _Scheduler_default_Allocate(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread
-)
-{
- ( void ) scheduler;
- ( void ) the_thread;
-
- return true;
-}
-
-void _Scheduler_default_Free(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread
-)
-{
- ( void ) scheduler;
- ( void ) the_thread;
-}
diff --git a/cpukit/score/src/schedulerdefaultnodedestroy.c b/cpukit/score/src/schedulerdefaultnodedestroy.c
new file mode 100644
index 0000000..d1d84f3
--- /dev/null
+++ b/cpukit/score/src/schedulerdefaultnodedestroy.c
@@ -0,0 +1,31 @@
+/**
+ * @file
+ *
+ * @brief Scheduler Default Node Destruction Operation
+ *
+ * @ingroup ScoreScheduler
+ */
+
+/*
+ * COPYRIGHT (c) 2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/scheduler.h>
+
+void _Scheduler_default_Node_destroy(
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
+{
+ (void) scheduler;
+ (void) the_thread;
+}
diff --git a/cpukit/score/src/schedulerdefaultnodeinit.c b/cpukit/score/src/schedulerdefaultnodeinit.c
new file mode 100644
index 0000000..ab371bd
--- /dev/null
+++ b/cpukit/score/src/schedulerdefaultnodeinit.c
@@ -0,0 +1,31 @@
+/**
+ * @file
+ *
+ * @brief Scheduler Default Node Initialization Operation
+ *
+ * @ingroup ScoreScheduler
+ */
+
+/*
+ * COPYRIGHT (c) 2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/scheduler.h>
+
+void _Scheduler_default_Node_initialize(
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
+{
+ (void) scheduler;
+ (void) the_thread;
+}
diff --git a/cpukit/score/src/scheduleredfallocate.c b/cpukit/score/src/scheduleredfallocate.c
deleted file mode 100644
index f9aaa57..0000000
--- a/cpukit/score/src/scheduleredfallocate.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * @file
- *
- * @brief Scheduler EDF Allocate
- * @ingroup ScoreScheduler
- */
-
-/*
- * Copyright (C) 2011 Petr Benes.
- * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/scheduleredfimpl.h>
-
-bool _Scheduler_EDF_Allocate(
- const Scheduler_Control *scheduler,
- Thread_Control *the_thread
-)
-{
- Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
-
- (void) scheduler;
-
- node->thread = the_thread;
- node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
-
- return true;
-}
diff --git a/cpukit/score/src/scheduleredfnodeinit.c b/cpukit/score/src/scheduleredfnodeinit.c
new file mode 100644
index 0000000..031feb0
--- /dev/null
+++ b/cpukit/score/src/scheduleredfnodeinit.c
@@ -0,0 +1,34 @@
+/**
+ * @file
+ *
+ * @brief Scheduler EDF Allocate
+ * @ingroup ScoreScheduler
+ */
+
+/*
+ * Copyright (C) 2011 Petr Benes.
+ * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/scheduleredfimpl.h>
+
+void _Scheduler_EDF_Node_initialize(
+ const Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
+{
+ Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
+
+ (void) scheduler;
+
+ node->thread = the_thread;
+ node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
+}
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 0d9525d..317d8ce 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -32,7 +32,7 @@ _Scheduler_priority_affinity_Node_get( Thread_Control *thread )
_Scheduler_Node_get( thread );
}
-bool _Scheduler_priority_affinity_SMP_Allocate(
+void _Scheduler_priority_affinity_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
)
@@ -44,8 +44,6 @@ bool _Scheduler_priority_affinity_SMP_Allocate(
node->Affinity = *_CPU_set_Default();
node->Affinity.set = &node->Affinity.preallocated;
-
- return true;
}
bool _Scheduler_priority_affinity_SMP_Get_affinity(
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 56bb0ac..e0ed75c 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -64,7 +64,7 @@ void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
_Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
}
-bool _Scheduler_priority_SMP_Allocate(
+void _Scheduler_priority_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *thread
)
@@ -72,8 +72,6 @@ bool _Scheduler_priority_SMP_Allocate(
Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
_Scheduler_SMP_Node_initialize( node );
-
- return true;
}
static void _Scheduler_priority_SMP_Do_update(
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index d5d3908..029da67 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -42,7 +42,7 @@ void _Scheduler_simple_SMP_Initialize( const Scheduler_Control *scheduler )
_Chain_Initialize_empty( &self->Ready );
}
-bool _Scheduler_simple_SMP_Allocate(
+void _Scheduler_simple_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Thread_Control *the_thread
)
@@ -50,8 +50,6 @@ bool _Scheduler_simple_SMP_Allocate(
Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( the_thread );
_Scheduler_SMP_Node_initialize( node );
-
- return true;
}
static void _Scheduler_simple_SMP_Do_update(
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 9c65d73..2a79549 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -52,7 +52,7 @@ bool _Thread_Initialize(
#endif
bool extension_status;
size_t i;
- bool scheduler_allocated = false;
+ bool scheduler_node_initialized = false;
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( 0 );
#if defined( RTEMS_SMP )
@@ -198,10 +198,8 @@ bool _Thread_Initialize(
the_thread->real_priority = priority;
the_thread->Start.initial_priority = priority;
- scheduler_allocated = _Scheduler_Allocate( scheduler, the_thread );
- if ( !scheduler_allocated ) {
- goto failed;
- }
+ _Scheduler_Node_initialize( scheduler, the_thread );
+ scheduler_node_initialized = true;
_Thread_Set_priority( the_thread, priority );
@@ -246,8 +244,8 @@ bool _Thread_Initialize(
failed:
- if ( scheduler_allocated ) {
- _Scheduler_Free( scheduler, the_thread );
+ if ( scheduler_node_initialized ) {
+ _Scheduler_Node_destroy( scheduler, the_thread );
}
_Workspace_Free( the_thread->Start.tls_area );
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index c65ef9a..92470e5 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -71,7 +71,7 @@ static void _Thread_Free( Thread_Control *the_thread )
/*
* Free the per-thread scheduling information.
*/
- _Scheduler_Free( _Scheduler_Get( the_thread ), the_thread );
+ _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), the_thread );
/*
* The thread might have been FP. So deal with that.
--
1.7.7
More information about the devel
mailing list