summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-28 06:54:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-08 09:55:28 +0200
commitb20b736382280fb522d176273645a7e955a97a60 (patch)
treebeb78ee50ef8b6a9257ecf5f8d276af35db11c5a /cpukit/score/src
parentscore: Add scheduler node implementation header (diff)
downloadrtems-b20b736382280fb522d176273645a7e955a97a60.tar.bz2
score: Introduce _Thread_Get_priority()
Avoid direct access to thread internal data fields.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r--cpukit/score/src/mpci.c2
-rw-r--r--cpukit/score/src/schedulercbsunblock.c8
-rw-r--r--cpukit/score/src/scheduleredfreleasejob.c4
-rw-r--r--cpukit/score/src/scheduleredfunblock.c2
-rw-r--r--cpukit/score/src/schedulerpriorityunblock.c2
-rw-r--r--cpukit/score/src/schedulersimpleunblock.c10
-rw-r--r--cpukit/score/src/threadchangepriority.c4
-rw-r--r--cpukit/score/src/threadqops.c4
-rw-r--r--cpukit/score/src/threadrestart.c4
-rw-r--r--cpukit/score/src/threadsetpriority.c2
10 files changed, 23 insertions, 19 deletions
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 87d90a63f9..315b33d90f 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -240,7 +240,7 @@ Status_Control _MPCI_Send_request_packet(
executing = _Per_CPU_Get_executing( cpu_self );
the_packet->source_tid = executing->Object.id;
- the_packet->source_priority = executing->current_priority;
+ the_packet->source_priority = _Thread_Get_priority( executing );
the_packet->to_convert =
( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 70db651080..0c1e48ebed 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -61,8 +61,10 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
the_thread->real_priority = priority;
if (
- _Thread_Priority_less_than( the_thread->current_priority, priority )
- || !_Thread_Owns_resources( the_thread )
+ _Thread_Priority_less_than(
+ _Thread_Get_priority( the_thread ),
+ priority
+ ) || !_Thread_Owns_resources( the_thread )
) {
the_thread->current_priority = priority;
}
@@ -84,7 +86,7 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( priority < _Thread_Heir->current_priority ) {
+ if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
_Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR );
}
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index 0fbf0f0f61..4c74c48699 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -32,7 +32,7 @@ static bool _Scheduler_EDF_Release_job_filter(
node = _Scheduler_EDF_Thread_get_node( the_thread );
- current_priority = the_thread->current_priority;
+ current_priority = _Thread_Get_priority( the_thread );
new_priority = *new_priority_p;
node->current_priority = new_priority;
@@ -69,7 +69,7 @@ static bool _Scheduler_EDF_Cancel_job_filter(
node = _Scheduler_EDF_Thread_get_node( the_thread );
- current_priority = the_thread->current_priority;
+ current_priority = _Thread_Get_priority( the_thread );
new_priority = node->background_priority;
node->current_priority = new_priority;
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 0f04cb3b2d..9b156eca46 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -52,7 +52,7 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( priority < _Thread_Heir->current_priority ) {
+ if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
_Scheduler_Update_heir(
the_thread,
priority == ( SCHEDULER_EDF_PRIO_MSB | PRIORITY_PSEUDO_ISR )
diff --git a/cpukit/score/src/schedulerpriorityunblock.c b/cpukit/score/src/schedulerpriorityunblock.c
index 9fc266bbc6..7186103f2b 100644
--- a/cpukit/score/src/schedulerpriorityunblock.c
+++ b/cpukit/score/src/schedulerpriorityunblock.c
@@ -67,7 +67,7 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock (
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( priority < _Thread_Heir->current_priority ) {
+ if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
_Scheduler_Update_heir( the_thread, priority == PRIORITY_PSEUDO_ISR );
}
diff --git a/cpukit/score/src/schedulersimpleunblock.c b/cpukit/score/src/schedulersimpleunblock.c
index a020f74767..de08fc1a5a 100644
--- a/cpukit/score/src/schedulersimpleunblock.c
+++ b/cpukit/score/src/schedulersimpleunblock.c
@@ -26,10 +26,12 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
Thread_Control *the_thread
)
{
- Scheduler_simple_Context *context =
- _Scheduler_simple_Get_context( scheduler );
+ Scheduler_simple_Context *context;
+ Priority_Control priority;
+ context = _Scheduler_simple_Get_context( scheduler );
_Scheduler_simple_Insert_priority_fifo( &context->Ready, the_thread );
+ priority = _Thread_Get_priority( the_thread );
/*
* If the thread that was unblocked is more important than the heir,
@@ -43,10 +45,10 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
+ if ( priority < _Thread_Get_priority( _Thread_Heir ) ) {
_Scheduler_Update_heir(
the_thread,
- the_thread->current_priority == PRIORITY_PSEUDO_ISR
+ priority == PRIORITY_PSEUDO_ISR
);
}
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index 97e7950693..3429e1a88d 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -120,7 +120,7 @@ static bool _Thread_Raise_priority_filter(
)
{
return _Thread_Priority_less_than(
- the_thread->current_priority,
+ _Thread_Get_priority( the_thread ),
*new_priority
);
}
@@ -149,7 +149,7 @@ static bool _Thread_Restore_priority_filter(
the_thread->priority_restore_hint = false;
- return *new_priority != the_thread->current_priority;
+ return *new_priority != _Thread_Get_priority( the_thread );
}
void _Thread_Restore_priority( Thread_Control *the_thread )
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index 4177151fae..e20241d494 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -230,7 +230,7 @@ static bool _Thread_queue_Priority_less(
scheduler_node = SCHEDULER_NODE_OF_WAIT_RBTREE_NODE( right );
the_right = _Scheduler_Node_get_owner( scheduler_node );
- return *the_left < the_right->current_priority;
+ return *the_left < _Thread_Get_priority( the_right );
}
static void _Thread_queue_Priority_priority_change(
@@ -302,7 +302,7 @@ static void _Thread_queue_Priority_do_enqueue(
#endif
scheduler_node = _Scheduler_Thread_get_own_node( the_thread );
- current_priority = the_thread->current_priority;
+ current_priority = _Thread_Get_priority( the_thread );
_RBTree_Initialize_node( &scheduler_node->Wait.Node.RBTree );
_RBTree_Insert_inline(
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index e963c732a8..149882795c 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -62,7 +62,7 @@ static bool _Thread_Raise_real_priority_filter(
real_priority = the_thread->real_priority;
new_priority = *new_priority_ptr;
- current_priority = the_thread->current_priority;
+ current_priority = _Thread_Get_priority( the_thread );
new_priority = _Thread_Priority_highest( real_priority, new_priority );
*new_priority_ptr = new_priority;
@@ -507,7 +507,7 @@ void _Thread_Cancel(
);
cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
- priority = executing->current_priority;
+ priority = _Thread_Get_priority( executing );
if ( _States_Is_dormant( the_thread->current_state ) ) {
_Thread_State_release( the_thread, &lock_context );
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index f6a061a281..d6b8319970 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -30,7 +30,7 @@ static bool _Thread_Set_priority_filter(
Priority_Control new_priority;
Priority_Control *old_priority_ptr;
- current_priority = the_thread->current_priority;
+ current_priority = _Thread_Get_priority( the_thread );
new_priority = *new_priority_ptr;
old_priority_ptr = arg;