summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-03 15:58:30 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-06-04 09:47:11 +0200
commit4d1f5008dbce6567e9501de8b7623b245c9f8283 (patch)
treeefea6ce1b08f4c813e000307c7419aff1dc92e03
parentscore: Replace _Scheduler_Allocate/Free() (diff)
downloadrtems-4d1f5008dbce6567e9501de8b7623b245c9f8283.tar.bz2
score: Rename _Scheduler_Update()
Rename _Scheduler_Update() to _Scheduler_Update_priority(). Add parameter for the new thread priority to avoid direct usage of Thread_Control::current_priority in the scheduler operation.
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h14
-rw-r--r--cpukit/score/include/rtems/score/schedulercbs.h2
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h7
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h22
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h15
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h2
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h7
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h2
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h2
-rw-r--r--cpukit/score/src/schedulerdefaultupdate.c10
-rw-r--r--cpukit/score/src/scheduleredfupdate.c6
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c7
-rw-r--r--cpukit/score/src/schedulerpriorityupdate.c7
-rw-r--r--cpukit/score/src/threadchangepriority.c2
-rw-r--r--cpukit/score/src/threadsetpriority.c6
15 files changed, 68 insertions, 43 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 7ca2133460..542e4aea46 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -77,8 +77,12 @@ typedef struct {
/** @see _Scheduler_Node_destroy() */
void ( *node_destroy )( const Scheduler_Control *, Thread_Control * );
- /** @see _Scheduler_Update() */
- void ( *update )( const Scheduler_Control *, Thread_Control * );
+ /** @see _Scheduler_Update_priority() */
+ void ( *update_priority )(
+ const Scheduler_Control *,
+ Thread_Control *,
+ Priority_Control
+ );
/** @see _Scheduler_Priority_compare() */
int ( *priority_compare )(
@@ -277,10 +281,12 @@ void _Scheduler_default_Node_destroy(
*
* @param[in] scheduler Unused.
* @param[in] the_thread Unused.
+ * @param[in] new_priority Unused.
*/
-void _Scheduler_default_Update(
+void _Scheduler_default_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index 23e528da66..473d6fec6f 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -55,7 +55,7 @@ extern "C" {
_Scheduler_EDF_Change_priority, /* change priority 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_Update_priority, /* update priority entry point */ \
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_CBS_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index a7ed88db39..7a20b5b031 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -48,7 +48,7 @@ extern "C" {
_Scheduler_EDF_Change_priority, /* change priority 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_Update_priority, /* update priority entry point */ \
_Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_EDF_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
@@ -161,9 +161,10 @@ void _Scheduler_EDF_Node_initialize(
* @param[in] the_thread will have its scheduler specific information
* structure updated.
*/
-void _Scheduler_EDF_Update(
+void _Scheduler_EDF_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 5e7c928686..e469214fa7 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -209,16 +209,22 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Node_destroy(
}
/**
- * @brief Scheduler update.
+ * @brief Updates the scheduler about a priority change of a not ready thread.
*
- * This routine updates @a the_thread->scheduler
+ * @param[in] the_thread The thread.
+ * @param[in] new_priority The new priority of the thread.
*/
-RTEMS_INLINE_ROUTINE void _Scheduler_Update(
+RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
)
{
- ( *scheduler->Operations.update )( scheduler, the_thread );
+ ( *scheduler->Operations.update_priority )(
+ scheduler,
+ the_thread,
+ new_priority
+ );
}
/**
@@ -367,7 +373,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Set(
_Scheduler_Node_destroy( current_scheduler, the_thread );
the_thread->scheduler = scheduler;
_Scheduler_Node_initialize( scheduler, the_thread );
- _Scheduler_Update( scheduler, the_thread );
+ _Scheduler_Update_priority(
+ scheduler,
+ the_thread,
+ the_thread->current_priority
+ );
_Thread_Clear_state( the_thread, STATES_MIGRATING );
}
#else
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 3f18f54c09..2e4f3abfc3 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -55,7 +55,7 @@ extern "C" {
_Scheduler_priority_Change_priority, /* change priority 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_Update_priority, /* update priority entry point */ \
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
@@ -139,16 +139,13 @@ void _Scheduler_priority_Schedule(
);
/**
- * @brief Update the scheduler priority.
- * This routine updates @a the_thread->scheduler based on @a the_scheduler
- * structures and thread state.
- *
- * @param[in] the_thread will have its scheduler specific information
- * structure updated.
+ * @brief Updates the scheduler node to reflect the new priority of the
+ * thread.
*/
-void _Scheduler_priority_Update(
+void _Scheduler_priority_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index ab35704a5e..0ba8191e44 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -57,7 +57,7 @@ extern "C" {
_Scheduler_priority_SMP_Change_priority, \
_Scheduler_priority_affinity_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
- _Scheduler_priority_SMP_Update, \
+ _Scheduler_priority_SMP_Update_priority, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index c17fcf4a05..cbb8a588ea 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -86,7 +86,7 @@ typedef struct {
_Scheduler_priority_SMP_Change_priority, \
_Scheduler_priority_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
- _Scheduler_priority_SMP_Update, \
+ _Scheduler_priority_SMP_Update_priority, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
@@ -119,9 +119,10 @@ void _Scheduler_priority_SMP_Change_priority(
bool prepend_it
);
-void _Scheduler_priority_SMP_Update(
+void _Scheduler_priority_SMP_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Priority_Control new_priority
);
void _Scheduler_priority_SMP_Yield(
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 9fc2d31f15..68ed527648 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -45,7 +45,7 @@ extern "C" {
_Scheduler_simple_Change_priority, /* change priority 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_default_Update_priority, /* update priority entry point */ \
_Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 6ab1dd2894..c0195e0bab 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -67,7 +67,7 @@ typedef struct {
_Scheduler_simple_SMP_Change_priority, \
_Scheduler_simple_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
- _Scheduler_default_Update, \
+ _Scheduler_default_Update_priority, \
_Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
diff --git a/cpukit/score/src/schedulerdefaultupdate.c b/cpukit/score/src/schedulerdefaultupdate.c
index 28d7e1d9a1..fcdc838502 100644
--- a/cpukit/score/src/schedulerdefaultupdate.c
+++ b/cpukit/score/src/schedulerdefaultupdate.c
@@ -21,11 +21,13 @@
#include <rtems/score/scheduler.h>
-void _Scheduler_default_Update(
+void _Scheduler_default_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
)
{
- ( void ) scheduler;
- ( void ) the_thread;
+ (void) scheduler;
+ (void) the_thread;
+ (void) new_priority;
}
diff --git a/cpukit/score/src/scheduleredfupdate.c b/cpukit/score/src/scheduleredfupdate.c
index 99a3e0e3f6..47e3a705ae 100644
--- a/cpukit/score/src/scheduleredfupdate.c
+++ b/cpukit/score/src/scheduleredfupdate.c
@@ -20,14 +20,16 @@
#include <rtems/score/scheduleredfimpl.h>
-void _Scheduler_EDF_Update(
+void _Scheduler_EDF_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
)
{
Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
(void) scheduler;
+ (void) new_priority;
if (node->queue_state == SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN) {
/* Shifts the priority to the region of background tasks. */
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index e0ed75c477..7915ce6bef 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -93,15 +93,16 @@ static void _Scheduler_priority_SMP_Do_update(
);
}
-void _Scheduler_priority_SMP_Update(
+void _Scheduler_priority_SMP_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *thread
+ Thread_Control *thread,
+ Priority_Control new_priority
)
{
Scheduler_Context *context = _Scheduler_Get_context( scheduler );
Scheduler_Node *node = _Scheduler_Node_get( thread );
- _Scheduler_priority_SMP_Do_update( context, node, thread->current_priority );
+ _Scheduler_priority_SMP_Do_update( context, node, new_priority );
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
diff --git a/cpukit/score/src/schedulerpriorityupdate.c b/cpukit/score/src/schedulerpriorityupdate.c
index e58a6091a3..3f05439e42 100644
--- a/cpukit/score/src/schedulerpriorityupdate.c
+++ b/cpukit/score/src/schedulerpriorityupdate.c
@@ -20,9 +20,10 @@
#include <rtems/score/schedulerpriorityimpl.h>
-void _Scheduler_priority_Update(
+void _Scheduler_priority_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Priority_Control new_priority
)
{
Scheduler_priority_Context *context =
@@ -31,7 +32,7 @@ void _Scheduler_priority_Update(
_Scheduler_priority_Ready_queue_update(
&node->Ready_queue,
- the_thread->current_priority,
+ new_priority,
&context->Bit_map,
&context->Ready[ 0 ]
);
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index 8059ab1678..c2e48e1cf1 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -106,7 +106,7 @@ void _Thread_Change_priority(
scheduler = _Scheduler_Get( the_thread );
_Scheduler_Schedule( scheduler, the_thread );
} else {
- _Scheduler_Update( scheduler, the_thread );
+ _Scheduler_Update_priority( scheduler, the_thread, new_priority );
}
_ISR_Enable( level );
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index e1286480a4..455cf20af2 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -28,5 +28,9 @@ void _Thread_Set_priority(
{
the_thread->current_priority = new_priority;
- _Scheduler_Update( _Scheduler_Get( the_thread ), the_thread );
+ _Scheduler_Update_priority(
+ _Scheduler_Get( the_thread),
+ the_thread,
+ new_priority
+ );
}