summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadq.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include/rtems/score/threadq.h')
-rw-r--r--cpukit/score/include/rtems/score/threadq.h117
1 files changed, 86 insertions, 31 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index a4ad0827a3..6f62506c26 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -30,6 +30,8 @@
extern "C" {
#endif
+struct Scheduler_Node;
+
/**
* @defgroup ScoreThreadQueue Thread Queue Handler
*
@@ -47,8 +49,6 @@ typedef struct Thread_queue_Queue Thread_queue_Queue;
typedef struct Thread_queue_Operations Thread_queue_Operations;
-typedef struct Thread_queue_Path Thread_queue_Path;
-
/**
* @brief Thread queue deadlock callout.
*
@@ -195,6 +195,56 @@ typedef struct {
*/
uint64_t timeout;
+#if defined(RTEMS_SMP)
+ /**
+ * @brief Representation of a thread queue path from a start thread queue to
+ * the terminal thread queue.
+ *
+ * The start thread queue is determined by the object on which a thread intends
+ * to block. The terminal thread queue is the thread queue reachable via
+ * thread queue links whose owner is not blocked on a thread queue. The thread
+ * queue links are determined by the thread queue owner and thread wait queue
+ * relationships.
+ */
+ struct {
+ /**
+ * @brief The chain of thread queue links defining the thread queue path.
+ */
+ Chain_Control Links;
+
+ /**
+ * @brief The start of a thread queue path.
+ */
+ Thread_queue_Link Start;
+ } Path;
+#endif
+
+ /**
+ * @brief Block to manage thread priority changes due to a thread queue
+ * operation.
+ */
+ struct {
+ /**
+ * @brief A priority action list.
+ */
+ Priority_Actions Actions;
+
+ /**
+ * @brief Count of threads to update the priority via
+ * _Thread_Priority_update().
+ */
+ size_t update_count;
+
+ /**
+ * @brief Threads to update the priority via _Thread_Priority_update().
+ *
+ * Currently, a maximum of two threads need an update in one rush, for
+ * example the thread of the thread queue operation and the owner of the
+ * thread queue.
+ */
+ Thread_Control *update[ 2 ];
+ } Priority;
+
/**
* @brief Invoked in case of a detected deadlock.
*
@@ -237,7 +287,13 @@ typedef struct {
/**
* @brief The actual thread priority queue.
*/
- RBTree_Control Queue;
+ Priority_Aggregation Queue;
+
+ /**
+ * @brief This priority queue is added to a scheduler node of the owner in
+ * case of priority inheritance.
+ */
+ struct Scheduler_Node *scheduler_node;
} Thread_queue_Priority_queue;
/**
@@ -289,6 +345,11 @@ typedef struct _Thread_queue_Heads {
#if defined(RTEMS_SMP)
/**
+ * @brief Boost priority.
+ */
+ Priority_Node Boost_priority;
+
+ /**
* @brief One priority queue per scheduler instance.
*/
Thread_queue_Priority_queue Priority[ RTEMS_ZERO_LENGTH_ARRAY ];
@@ -337,34 +398,33 @@ struct Thread_queue_Queue {
};
/**
- * @brief Thread queue priority change operation.
+ * @brief Thread queue action operation.
*
* @param[in] queue The actual thread queue.
* @param[in] the_thread The thread.
- * @param[in] new_priority The new priority value.
- *
- * @see Thread_queue_Operations.
+ * @param[in] queue_context The thread queue context providing the thread queue
+ * action set to perform. Returns the thread queue action set to perform on
+ * the thread queue owner or the empty set in case there is nothing to do.
*/
-typedef void ( *Thread_queue_Priority_change_operation )(
- Thread_queue_Queue *queue,
- Thread_Control *the_thread,
- Priority_Control new_priority
+typedef void ( *Thread_queue_Priority_actions_operation )(
+ Thread_queue_Queue *queue,
+ Priority_Actions *priority_actions
);
/**
* @brief Thread queue enqueue operation.
*
* A potential thread to update the priority due to priority inheritance is
- * returned via the thread queue path. This thread is handed over to
- * _Thread_Update_priority().
+ * returned via the thread queue context. This thread is handed over to
+ * _Thread_Priority_update().
*
* @param[in] queue The actual thread queue.
* @param[in] the_thread The thread to enqueue on the queue.
*/
typedef void ( *Thread_queue_Enqueue_operation )(
- Thread_queue_Queue *queue,
- Thread_Control *the_thread,
- Thread_queue_Path *path
+ Thread_queue_Queue *queue,
+ Thread_Control *the_thread,
+ Thread_queue_Context *queue_context
);
/**
@@ -374,8 +434,9 @@ typedef void ( *Thread_queue_Enqueue_operation )(
* @param[in] the_thread The thread to extract from the thread queue.
*/
typedef void ( *Thread_queue_Extract_operation )(
- Thread_queue_Queue *queue,
- Thread_Control *the_thread
+ Thread_queue_Queue *queue,
+ Thread_Control *the_thread,
+ Thread_queue_Context *queue_context
);
/**
@@ -390,9 +451,10 @@ typedef void ( *Thread_queue_Extract_operation )(
* @return The previous first thread on the queue.
*/
typedef Thread_Control *( *Thread_queue_Surrender_operation )(
- Thread_queue_Queue *queue,
- Thread_queue_Heads *heads,
- Thread_Control *previous_owner
+ Thread_queue_Queue *queue,
+ Thread_queue_Heads *heads,
+ Thread_Control *previous_owner,
+ Thread_queue_Context *queue_context
);
/**
@@ -415,16 +477,9 @@ typedef Thread_Control *( *Thread_queue_First_operation )(
*/
struct Thread_queue_Operations {
/**
- * @brief Thread queue priority change operation.
- *
- * Called by _Thread_Change_priority() to notify a thread about a priority
- * change. In case this thread waits currently for a resource the handler
- * may adjust its data structures according to the new priority value. This
- * handler must not be NULL, instead the default handler
- * _Thread_Do_nothing_priority_change() should be used in case nothing needs
- * to be done during a priority change.
- */
- Thread_queue_Priority_change_operation priority_change;
+ * @brief Thread queue priority actions operation.
+ */
+ Thread_queue_Priority_actions_operation priority_actions;
/**
* @brief Thread queue enqueue operation.