summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadqimpl.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-07-15 12:37:36 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-07-15 13:42:30 -0500
commit32506647001a815e3c0daf25757d386104a07184 (patch)
tree8ab18c675b7617011d405e915e00d455d18ea334 /cpukit/score/include/rtems/score/threadqimpl.h
parentThread Queue Priority Discipline Reimplemented with RBTree (diff)
downloadrtems-32506647001a815e3c0daf25757d386104a07184.tar.bz2
Thread Queue: Merge discipline subroutines into main methods
There was a lot of duplication between the discipline subroutines. With the transition to RBTrees for priority discipline, there were only a few lines of source code manipulating the data structure for FIFO and priority. Thus is made sense to fold these back into the main methods. As part of doing this all of the tests for discipline were changed to be in the same order.
Diffstat (limited to 'cpukit/score/include/rtems/score/threadqimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h157
1 files changed, 24 insertions, 133 deletions
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 0acc66ee6c..0e139cdbc6 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -60,6 +60,9 @@ typedef void ( *Thread_queue_Timeout_callout )(
* the_thread_queue. The selection of this thread is based on
* the discipline of the_thread_queue. If no threads are waiting
* on the_thread_queue, then NULL is returned.
+ *
+ * - INTERRUPT LATENCY:
+ * + single case
*/
Thread_Control *_Thread_queue_Dequeue(
Thread_queue_Control *the_thread_queue
@@ -123,6 +126,9 @@ void _Thread_queue_Extract(
* @param[in] the_thread is the pointer to a thread control block that
* is to be removed
* @param[in] return_code specifies the status to be returned.
+ *
+ * - INTERRUPT LATENCY:
+ * + single case
*/
void _Thread_queue_Extract_with_return_code(
Thread_queue_Control *the_thread_queue,
@@ -213,138 +219,6 @@ Thread_Control *_Thread_queue_Dequeue_priority(
);
/**
- * @brief Enqueues the currently executing thread on the_thread_queue.
- *
- * This routine enqueues the currently executing thread on
- * the_thread_queue with an optional timeout using the
- * priority discipline.
- *
- * @param[in] the_thread_queue is the pointer to threadq
- * @param[in] the_thread is the thread to insert
- * @param[in] level_p is a pointer to an interrupt level to be returned
- *
- * @retval This methods returns an indication of the blocking state as
- * well as filling in *@ level_p with the previous interrupt level.
- *
- * - INTERRUPT LATENCY:
- * + single case
- */
-Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- ISR_Level *level_p
-);
-
-/**
- * @brief Removes the_thread and cancels related timeouts.
- *
- * This routine removes the_thread from the_thread_queue
- * and cancels any timeouts associated with this blocking.
- * @param[in] the_thread_queue pointer to a threadq header
- * @param[in] the_thread pointer to a thread control block
- * @param[in] requeuing true if requeuing and should not alter
- * timeout or state
- *
- * - INTERRUPT LATENCY:
- * + single case
- *
- * @retval true The extract operation was performed by the executing context.
- * @retval false Otherwise.
- */
-void _Thread_queue_Extract_priority_helper(
- Thread_Control *the_thread,
- uint32_t return_code,
- bool requeuing
-);
-
-/**
- * @brief Wraps the underlying call and hides the requeuing argument.
- *
- * This macro wraps the underlying call and hides the requeuing argument.
- */
-#define _Thread_queue_Extract_priority( _the_thread, _return_code ) \
- _Thread_queue_Extract_priority_helper( _the_thread, _return_code, false )
-
-/**
- * @brief Get highest priority thread on the_thread_queue.
- *
- * This function returns a pointer to the "first" thread
- * on @a the_thread_queue. The "first" thread is the highest
- * priority thread waiting on @a the_thread_queue.
- *
- * @param[in] the_thread_queue is the pointer to the thread queue
- * @retval first thread or NULL
- */
-Thread_Control *_Thread_queue_First_priority(
- Thread_queue_Control *the_thread_queue
-);
-
-/**
- * @brief Gets a pointer to the thread which has been waiting the longest.
- *
- * This function returns a pointer to the thread which has
- * been waiting the longest on the_thread_queue. If no
- * threads are waiting on the_thread_queue, then NULL is returned.
- *
- * @param[in] the_thread_queue is the pointer to threadq
- *
- * @retval thread dequeued or NULL
- *
- * - INTERRUPT LATENCY:
- * + check sync
- * + FIFO
- */
-Thread_Control *_Thread_queue_Dequeue_fifo(
- Thread_queue_Control *the_thread_queue
-);
-
-/**
- * @brief Enqueues the currently executing thread on the_thread_queue.
- *
- * This routine enqueues the currently executing thread on
- * the_thread_queue with an optional timeout using the
- * FIFO discipline.
- *
- * @param[in] the_thread_queue pointer to threadq
- * @param[in] the_thread pointer to the thread to block
- * @param[in] level_p interrupt level in case the operation blocks actually
- *
- * - INTERRUPT LATENCY:
- * + single case
- */
-Thread_blocking_operation_States _Thread_queue_Enqueue_fifo (
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- ISR_Level *level_p
-);
-
-/**
- * @brief Removes the_thread from the_thread_queue and cancels any timeouts.
- *
- * This routine removes the_thread from the_thread_queue
- * and cancels any timeouts associated with this blocking.
- */
-void _Thread_queue_Extract_fifo(
- Thread_Control *the_thread,
- uint32_t return_code
-);
-
-/**
- * @brief Gets a pointer to the "first" thread on the_thread_queue.
- *
- * This function returns a pointer to the "first" thread
- * on the_thread_queue. The first thread is the thread
- * which has been waiting longest on the_thread_queue.
- *
- * @param[in] the_thread_queue is the pointer to threadq
- *
- * @retval first thread or NULL
- */
-Thread_Control *_Thread_queue_First_fifo(
- Thread_queue_Control *the_thread_queue
-);
-
-/**
* @brief Thread queue timeout.
*
* This routine is invoked when a task's request has not
@@ -355,7 +229,7 @@ Thread_Control *_Thread_queue_First_fifo(
*
* @param[in] id thread id
*/
-void _Thread_queue_Timeout (
+void _Thread_queue_Timeout(
Objects_Id id,
void *ignored
);
@@ -392,6 +266,23 @@ int _Thread_queue_Compare_priority(
);
/**
+ * @brief Invoked when a thread changes priority and is blocked.
+ *
+ * This routine is invoked when a thread changes priority and is
+ * blocked on a thread queue. If the queue is priority ordered,
+ * the_thread is removed from the_thread_queue and reinserted using
+ * its new priority. This method has no impact on the state of the_thread
+ * or of any timeouts associated with this blocking.
+ *
+ * @param[in] the_thread_queue pointer to a threadq header
+ * @param[in] the_thread pointer to a thread control block
+ */
+void _Thread_queue_Requeue(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+);
+
+/**
* This routine is invoked to indicate that the specified thread queue is
* entering a critical section.
*/