[PATCH 1/2] score: PR2140: _Thread_queue_Extract()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Aug 23 10:58:32 UTC 2013


Return if the caller performed the extract operation.  The caller may
perform certain actions if it was the one who actually performed the
extract operation.
---
 cpukit/score/include/rtems/score/threadqimpl.h |   12 +++++++++---
 cpukit/score/src/threadqextract.c              |    6 +++---
 cpukit/score/src/threadqextractfifo.c          |    5 +++--
 cpukit/score/src/threadqextractpriority.c      |    8 +++++---
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index c72982d..0762f0d 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -135,8 +135,11 @@ void _Thread_queue_Requeue(
  *
  *  @param[in] the_thread_queue is the pointer to the ThreadQ header
  *  @param[in] the_thread is the pointer to a thread control block that is to be removed
+ *
+ *  @retval true The extract operation was performed by the caller.
+ *  @retval false Otherwise.
  */
-void _Thread_queue_Extract(
+bool _Thread_queue_Extract(
   Thread_queue_Control *the_thread_queue,
   Thread_Control       *the_thread
 );
@@ -258,8 +261,11 @@ Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
  *         timeout or state
  *  - INTERRUPT LATENCY:
  *    + EXTRACT_PRIORITY
+ *
+ *  @retval true The extract operation was performed by the caller.
+ *  @retval false Otherwise.
  */
-void _Thread_queue_Extract_priority_helper(
+bool _Thread_queue_Extract_priority_helper(
   Thread_queue_Control *the_thread_queue,
   Thread_Control       *the_thread,
   bool                  requeuing
@@ -332,7 +338,7 @@ Thread_blocking_operation_States _Thread_queue_Enqueue_fifo (
  *  This routine removes the_thread from the_thread_queue
  *  and cancels any timeouts associated with this blocking.
  */
-void _Thread_queue_Extract_fifo(
+bool _Thread_queue_Extract_fifo(
   Thread_queue_Control *the_thread_queue,
   Thread_Control       *the_thread
 );
diff --git a/cpukit/score/src/threadqextract.c b/cpukit/score/src/threadqextract.c
index 8e0e3e8..b2da4f0 100644
--- a/cpukit/score/src/threadqextract.c
+++ b/cpukit/score/src/threadqextract.c
@@ -21,7 +21,7 @@
 
 #include <rtems/score/threadqimpl.h>
 
-void _Thread_queue_Extract(
+bool _Thread_queue_Extract(
   Thread_queue_Control *the_thread_queue,
   Thread_Control       *the_thread
 )
@@ -31,8 +31,8 @@ void _Thread_queue_Extract(
    * is a macro and the underlying methods do not have the same signature.
    */
   if  ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY )
-    _Thread_queue_Extract_priority( the_thread_queue, the_thread );
+    return _Thread_queue_Extract_priority( the_thread_queue, the_thread );
   else /* must be THREAD_QUEUE_DISCIPLINE_FIFO */
-    _Thread_queue_Extract_fifo( the_thread_queue, the_thread );
+    return _Thread_queue_Extract_fifo( the_thread_queue, the_thread );
 
 }
diff --git a/cpukit/score/src/threadqextractfifo.c b/cpukit/score/src/threadqextractfifo.c
index 5038738..21c9827 100644
--- a/cpukit/score/src/threadqextractfifo.c
+++ b/cpukit/score/src/threadqextractfifo.c
@@ -25,7 +25,7 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
-void _Thread_queue_Extract_fifo(
+bool _Thread_queue_Extract_fifo(
   Thread_queue_Control *the_thread_queue __attribute__((unused)),
   Thread_Control       *the_thread
 )
@@ -36,7 +36,7 @@ void _Thread_queue_Extract_fifo(
 
   if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
     _ISR_Enable( level );
-    return;
+    return false;
   }
 
   _Chain_Extract_unprotected( &the_thread->Object.Node );
@@ -58,4 +58,5 @@ void _Thread_queue_Extract_fifo(
     _Thread_MP_Free_proxy( the_thread );
 #endif
 
+  return true;
 }
diff --git a/cpukit/score/src/threadqextractpriority.c b/cpukit/score/src/threadqextractpriority.c
index 2b79398..d22fdf2 100644
--- a/cpukit/score/src/threadqextractpriority.c
+++ b/cpukit/score/src/threadqextractpriority.c
@@ -24,7 +24,7 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/watchdogimpl.h>
 
-void _Thread_queue_Extract_priority_helper(
+bool _Thread_queue_Extract_priority_helper(
   Thread_queue_Control *the_thread_queue __attribute__((unused)),
   Thread_Control       *the_thread,
   bool                  requeuing
@@ -45,7 +45,7 @@ void _Thread_queue_Extract_priority_helper(
   _ISR_Disable( level );
   if ( !_States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
     _ISR_Enable( level );
-    return;
+    return false;
   }
 
   /*
@@ -87,7 +87,7 @@ void _Thread_queue_Extract_priority_helper(
 
   if ( requeuing ) {
     _ISR_Enable( level );
-    return;
+    return true;
   }
 
   if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
@@ -103,4 +103,6 @@ void _Thread_queue_Extract_priority_helper(
   if ( !_Objects_Is_local_id( the_thread->Object.id ) )
     _Thread_MP_Free_proxy( the_thread );
 #endif
+
+  return true;
 }
-- 
1.7.7




More information about the devel mailing list