diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-23 11:52:01 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-08-26 10:22:18 +0200 |
commit | 2077ae4cc8e0a16f4cb117b88a0cf9b463c7980e (patch) | |
tree | 025efe3c0a30991a7e26f361ee8d1d6b7e7aed91 | |
parent | libblock: PR2040: Avoid NULL pointer access (diff) | |
download | rtems-2077ae4cc8e0a16f4cb117b88a0cf9b463c7980e.tar.bz2 |
score: PR2140: _Thread_queue_Extract()
Return if the executing context performed the extract operation since
interrupts may interfere.
-rw-r--r-- | cpukit/score/include/rtems/score/threadq.h | 6 | ||||
-rw-r--r-- | cpukit/score/src/threadqextract.c | 6 | ||||
-rw-r--r-- | cpukit/score/src/threadqextractfifo.c | 5 | ||||
-rw-r--r-- | cpukit/score/src/threadqextractpriority.c | 8 |
4 files changed, 14 insertions, 11 deletions
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h index 357bbf713c..4ce1fedb3d 100644 --- a/cpukit/score/include/rtems/score/threadq.h +++ b/cpukit/score/include/rtems/score/threadq.h @@ -113,7 +113,7 @@ void _Thread_queue_Requeue( * This routine removes the_thread from the_thread_queue * and cancels any timeouts associated with this blocking. */ -void _Thread_queue_Extract( +bool _Thread_queue_Extract( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread ); @@ -189,7 +189,7 @@ Thread_blocking_operation_States _Thread_queue_Enqueue_priority ( * This routine removes the_thread from the_thread_queue * and cancels any timeouts associated with this blocking. */ -void _Thread_queue_Extract_priority_helper( +bool _Thread_queue_Extract_priority_helper( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread, bool requeuing @@ -242,7 +242,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 21aa2c2a46..b98152762e 100644 --- a/cpukit/score/src/threadqextract.c +++ b/cpukit/score/src/threadqextract.c @@ -41,7 +41,7 @@ * INTERRUPT LATENCY: NONE */ -void _Thread_queue_Extract( +bool _Thread_queue_Extract( Thread_queue_Control *the_thread_queue, Thread_Control *the_thread ) @@ -51,8 +51,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 f40464d73c..3f6c3ea4a7 100644 --- a/cpukit/score/src/threadqextractfifo.c +++ b/cpukit/score/src/threadqextractfifo.c @@ -42,7 +42,7 @@ * EXTRACT_FIFO */ -void _Thread_queue_Extract_fifo( +bool _Thread_queue_Extract_fifo( Thread_queue_Control *the_thread_queue __attribute__((unused)), Thread_Control *the_thread ) @@ -53,7 +53,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 ); @@ -75,4 +75,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 706f51e828..f314f75da9 100644 --- a/cpukit/score/src/threadqextractpriority.c +++ b/cpukit/score/src/threadqextractpriority.c @@ -43,7 +43,7 @@ * EXTRACT_PRIORITY */ -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 @@ -62,7 +62,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; } /* @@ -103,7 +103,7 @@ void _Thread_queue_Extract_priority_helper( if ( requeuing ) { _ISR_Enable( level ); - return; + return true; } if ( !_Watchdog_Is_active( &the_thread->Timer ) ) { @@ -119,4 +119,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; } |