summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/coremutex.h2
-rw-r--r--cpukit/score/include/rtems/score/thread.h63
2 files changed, 61 insertions, 4 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h
index ba2ae02782..25d6f488e4 100644
--- a/cpukit/score/include/rtems/score/coremutex.h
+++ b/cpukit/score/include/rtems/score/coremutex.h
@@ -216,7 +216,7 @@ typedef struct {
*
* The following defines the control block used to manage each mutex.
*/
-typedef struct {
+typedef struct CORE_mutex_Control {
/** This field is the Waiting Queue used to manage the set of tasks
* which are blocked waiting to lock the mutex.
*/
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index b0b40f713c..4c51977106 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -276,15 +276,23 @@ typedef struct {
Thread_queue_Control *queue;
} Thread_Wait_information;
+struct CORE_mutex_Control;
/**
* @brief Encapsulates base and inherited priority.
*/
typedef struct Thread_Priority_node {
- Chain_Node Node;
+ Chain_Node Node;
/** current priority = min(real_priority, min(Inherited_priorities)) */
- Priority_Control current_priority;
+ Priority_Control current_priority;
/** base priority irrespective of inheritance/ceiling */
- Priority_Control real_priority;
+ Priority_Control real_priority;
+ /** NULL if not waiting, or the mutex blocked upon
+ * if waiting. If not NULL, then this Priority_node is on the mutex holder's
+ * Priority_node.Inherited_priorities list. */
+ struct CORE_mutex_Control *waiting_to_hold;
+ /** Priority Queue of thread Priority_nodes blocked by this one, thus
+ * possibly contributing their priority to the current_priority. */
+ Chain_Control Inherited_priorities;
} Thread_Priority_node;
/**
@@ -787,6 +795,55 @@ void _Thread_Resume(
*/
bool _Thread_Evaluate_mode( void );
+/**
+ * This routine sets the thread's priority_node->current_priority to the
+ * minimum of the real_priority and the first node of Inherited_priorities,
+ * if any.
+ */
+void _Thread_Evaluate_priority(
+ Thread_Control *the_thread
+);
+
+/**
+ * This routine adds a thread's Priority_node to the mutex holder's
+ * Inherited_priorities list, and sets the waiting_to_hold field to the
+ * mutex.
+ *
+ * Returns true if the enqueued node is at the head of the holder's
+ * Inherited priorities, and therefore the holder's priority may change.
+ */
+bool _Thread_Enqueue_priority_node(
+ Thread_Control *the_thread,
+ struct CORE_mutex_Control *the_mutex
+);
+
+/**
+ * This routine removes a thread's Priority_node from an
+ * Inherited_priorities list, updates the mutex holder's
+ * current_priority if needed, and clears the mutex field.
+ *
+ * Returns the mutex that the thread was waiting on.
+ */
+struct CORE_mutex_Control* _Thread_Dequeue_priority_node(
+ Thread_Priority_node *thread_pn
+);
+
+/**
+ * This routine updates the position of a thread's Priority_node in an
+ * Inherited_priorities list if on one.
+ */
+void _Thread_Requeue_priority_node(
+ Thread_Control *the_thread
+);
+
+/**
+ * This routine removes the inherited priorities from the mutex being
+ * released and updates the holder's priority if necessary.
+ */
+void _Thread_Release_inherited_priority(
+ struct CORE_mutex_Control *the_mutex
+);
+
#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
/**
* This routine is the body of the system idle thread.