From 215ccceed3938c2d90a5e44493ac3d016230a502 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 23 Aug 2013 11:52:01 +0200 Subject: score: PR2140: _Thread_queue_Extract() Return if the executing context performed the extract operation since interrupts may interfere. --- 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 c72982d1c3..11de27872e 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 executing context. + * @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 executing context. + * @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 8e0e3e8baa..b2da4f0f87 100644 --- a/cpukit/score/src/threadqextract.c +++ b/cpukit/score/src/threadqextract.c @@ -21,7 +21,7 @@ #include -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 5038738c12..21c98276ab 100644 --- a/cpukit/score/src/threadqextractfifo.c +++ b/cpukit/score/src/threadqextractfifo.c @@ -25,7 +25,7 @@ #include #include -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 2b79398490..d22fdf2836 100644 --- a/cpukit/score/src/threadqextractpriority.c +++ b/cpukit/score/src/threadqextractpriority.c @@ -24,7 +24,7 @@ #include #include -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; } -- cgit v1.2.3