summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems
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/include/rtems
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/include/rtems')
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h2
-rw-r--r--cpukit/score/include/rtems/score/mrspimpl.h4
-rw-r--r--cpukit/score/include/rtems/score/schedulersimpleimpl.h6
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h18
4 files changed, 25 insertions, 5 deletions
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index d40d91c4fd..25094a49df 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -393,7 +393,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Set_owner(
Per_CPU_Control *cpu_self;
priority_ceiling = the_mutex->priority_ceiling;
- current_priority = owner->current_priority;
+ current_priority = _Thread_Get_priority( owner );
if ( current_priority < priority_ceiling ) {
_CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h
index 5f639d7e04..cc00aa3cfd 100644
--- a/cpukit/score/include/rtems/score/mrspimpl.h
+++ b/cpukit/score/include/rtems/score/mrspimpl.h
@@ -88,7 +88,7 @@ RTEMS_INLINE_ROUTINE bool _MRSP_Restore_priority_filter(
*new_priority
);
- return *new_priority != thread->current_priority;
+ return *new_priority != _Thread_Get_priority( thread );
}
RTEMS_INLINE_ROUTINE void _MRSP_Restore_priority(
@@ -325,7 +325,7 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Seize(
{
Status_Control status;
const Scheduler_Control *scheduler = _Scheduler_Get_own( executing );
- Priority_Control initial_priority = executing->current_priority;
+ Priority_Control initial_priority = _Thread_Get_priority( executing );
Priority_Control ceiling_priority = _MRSP_Get_priority( mrsp, scheduler );
bool priority_ok = !_Thread_Priority_less_than(
ceiling_priority,
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index b73a1b2c78..85951fa631 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -46,7 +46,8 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
const Thread_Control *thread_next = (const Thread_Control *) next;
- return thread_to_insert->current_priority <= thread_next->current_priority;
+ return _Thread_Get_priority( thread_to_insert )
+ <= _Thread_Get_priority( thread_next );
}
RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
@@ -57,7 +58,8 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_fifo_order(
const Thread_Control *thread_to_insert = (const Thread_Control *) to_insert;
const Thread_Control *thread_next = (const Thread_Control *) next;
- return thread_to_insert->current_priority < thread_next->current_priority;
+ return _Thread_Get_priority( thread_to_insert )
+ < _Thread_Get_priority( thread_next );
}
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_lifo(
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index adb10cbd6f..1fce842533 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -930,6 +930,24 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
}
/**
+ * @brief Returns the priority of the thread.
+ *
+ * Returns the user API and thread wait information relevant thread priority.
+ * This includes temporary thread priority adjustments due to locking
+ * protocols, a job release or the POSIX sporadic server for example.
+ *
+ * @return The priority of the thread.
+ *
+ * @see _Scheduler_Node_get_priority().
+ */
+RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(
+ const Thread_Control *the_thread
+)
+{
+ return the_thread->current_priority;
+}
+
+/**
* @brief Acquires the thread wait default lock inside a critical section
* (interrupts disabled).
*