summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-03 10:29:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-04 08:37:06 +0200
commit8e46738436b18d0f1a9424a95b678ab1596cb092 (patch)
tree252be226da9107952a87628fd4e5265df603c167 /cpukit/score/include
parentsptests/spsem03: New test (diff)
downloadrtems-8e46738436b18d0f1a9424a95b678ab1596cb092.tar.bz2
score: Replace _Scheduler_Allocate/Free()
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().
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h16
-rw-r--r--cpukit/score/include/rtems/score/schedulercbs.h13
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h13
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h30
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h4
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h6
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h6
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h4
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h6
9 files changed, 48 insertions, 50 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index c4bd350859..7ca2133460 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 46db8e5609..23e528da66 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 301940c91d..a7ed88db39 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 f1acf32d35..5e7c928686 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 b3c1466066..3f18f54c09 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 55271dcf0e..ab35704a5e 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 1030b9fac0..c17fcf4a05 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 6b59a0ab9e..9fc2d31f15 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 6c4d421ed7..6ab1dd2894 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
);