summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadq.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-21 10:17:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:45 +0200
commit568af83542eec9343c24d417ed6a219d22046233 (patch)
treef66fde552c81c31930df66cb8a00444efeb0f30a /cpukit/score/include/rtems/score/threadq.h
parentscore: Add Thread_queue_Control::Lock (diff)
downloadrtems-568af83542eec9343c24d417ed6a219d22046233.tar.bz2
score: Add Thread_queue_Operations
Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadq.h')
-rw-r--r--cpukit/score/include/rtems/score/threadq.h49
1 files changed, 46 insertions, 3 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index 1f99ffde04..c483b87620 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -21,9 +21,11 @@
#include <rtems/score/chain.h>
#include <rtems/score/isrlock.h>
+#include <rtems/score/percpu.h>
+#include <rtems/score/priority.h>
+#include <rtems/score/rbtree.h>
#include <rtems/score/states.h>
#include <rtems/score/threadsync.h>
-#include <rtems/score/rbtree.h>
#ifdef __cplusplus
extern "C" {
@@ -40,6 +42,42 @@ extern "C" {
*/
/**@{*/
+typedef struct Thread_queue_Control Thread_queue_Control;
+
+/**
+ * @brief Thread queue priority change operation.
+ *
+ * @param[in] the_thread The thread.
+ * @param[in] new_priority The new priority value.
+ * @param[in] queue The thread queue.
+ *
+ * @see Thread_queue_Operations.
+ */
+typedef void ( *Thread_queue_Priority_change_operation )(
+ Thread_Control *the_thread,
+ Priority_Control new_priority,
+ Thread_queue_Control *queue
+);
+
+/**
+ * @brief Thread queue operations.
+ *
+ * @see _Thread_wait_Set_operations().
+ */
+typedef struct {
+ /**
+ * @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;
+} Thread_queue_Operations;
+
/**
* The following enumerated type details all of the disciplines
* supported by the Thread Queue Handler.
@@ -53,7 +91,7 @@ typedef enum {
* This is the structure used to manage sets of tasks which are blocked
* waiting to acquire a resource.
*/
-typedef struct {
+struct Thread_queue_Control {
/** This union contains the data structures used to manage the blocked
* set of tasks which varies based upon the discipline.
*/
@@ -65,6 +103,11 @@ typedef struct {
} Queues;
/**
+ * @brief The operations for this thread queue.
+ */
+ const Thread_queue_Operations *operations;
+
+ /**
* @brief Lock to protect this thread queue.
*
* It may be used to protect additional state of the object embedding this
@@ -83,7 +126,7 @@ typedef struct {
* waiting on this thread queue.
*/
uint32_t timeout_status;
-} Thread_queue_Control;
+};
/**@}*/