[PATCH 02/45] score: _Thread_queue_Extract()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri May 15 11:41:02 UTC 2015
Remove thread queue parameter from _Thread_queue_Extract() since the
current thread queue is stored in the thread control block.
---
cpukit/rtems/src/msgmp.c | 2 +-
cpukit/rtems/src/partmp.c | 2 +-
cpukit/rtems/src/regionmp.c | 2 +-
cpukit/rtems/src/regionprocessqueue.c | 2 +-
cpukit/rtems/src/semmp.c | 2 +-
cpukit/score/include/rtems/score/threadqimpl.h | 16 +++++---------
cpukit/score/src/corerwlockrelease.c | 2 +-
cpukit/score/src/mpci.c | 2 +-
cpukit/score/src/threadqenqueue.c | 14 ++++++-------
cpukit/score/src/threadqextractwithproxy.c | 7 +------
cpukit/score/src/threadqprocesstimeout.c | 1 -
testsuites/sptests/spthreadq01/init.c | 29 ++++----------------------
12 files changed, 23 insertions(+), 58 deletions(-)
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index 7043138..ddad64a 100644
--- a/cpukit/rtems/src/msgmp.c
+++ b/cpukit/rtems/src/msgmp.c
@@ -291,7 +291,7 @@ void _Message_queue_MP_Process_packet (
the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
if (! _Thread_Is_null( the_thread ) )
- _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+ _Thread_queue_Extract( the_thread );
_MPCI_Return_packet( the_packet_prefix );
break;
diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c
index 943c24a..f41fd22 100644
--- a/cpukit/rtems/src/partmp.c
+++ b/cpukit/rtems/src/partmp.c
@@ -209,7 +209,7 @@ void _Partition_MP_Process_packet (
the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
if ( ! _Thread_Is_null( the_thread ) )
- _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+ _Thread_queue_Extract( the_thread );
_MPCI_Return_packet( the_packet_prefix );
break;
diff --git a/cpukit/rtems/src/regionmp.c b/cpukit/rtems/src/regionmp.c
index 58dfa99..8bce822 100644
--- a/cpukit/rtems/src/regionmp.c
+++ b/cpukit/rtems/src/regionmp.c
@@ -195,7 +195,7 @@ void _Region_MP_Process_packet (
the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
if ( ! _Thread_Is_null( the_thread ) )
- _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+ _Thread_queue_Extract( the_thread );
_MPCI_Return_packet( the_packet_prefix );
break;
diff --git a/cpukit/rtems/src/regionprocessqueue.c b/cpukit/rtems/src/regionprocessqueue.c
index 54081af..a06a077 100644
--- a/cpukit/rtems/src/regionprocessqueue.c
+++ b/cpukit/rtems/src/regionprocessqueue.c
@@ -61,7 +61,7 @@ void _Region_Process_queue(
*(void **)the_thread->Wait.return_argument = the_segment;
the_region->number_of_used_blocks += 1;
- _Thread_queue_Extract( &the_region->Wait_queue, the_thread );
+ _Thread_queue_Extract( the_thread );
the_thread->Wait.return_code = RTEMS_SUCCESSFUL;
}
_Thread_Enable_dispatch();
diff --git a/cpukit/rtems/src/semmp.c b/cpukit/rtems/src/semmp.c
index eabd1b7..d94d908 100644
--- a/cpukit/rtems/src/semmp.c
+++ b/cpukit/rtems/src/semmp.c
@@ -188,7 +188,7 @@ void _Semaphore_MP_Process_packet (
the_thread = _Thread_MP_Find_proxy( the_packet->proxy_id );
if ( ! _Thread_Is_null( the_thread ) )
- _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
+ _Thread_queue_Extract( the_thread );
_MPCI_Return_packet( the_packet_prefix );
break;
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 6eac364..6fc38cf 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -78,25 +78,20 @@ void _Thread_queue_Enqueue(
/**
* @brief Extracts thread from thread queue.
*
- * This routine removes @a the_thread from @a the_thread_queue
+ * This routine removes @a the_thread its thread queue
* and cancels any timeouts associated with this blocking.
*
- * @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
*/
-void _Thread_queue_Extract(
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread
-);
+void _Thread_queue_Extract( Thread_Control *the_thread );
/**
* @brief Extracts thread from thread queue (w/return code).
*
- * This routine removes @a the_thread from @a the_thread_queue
+ * This routine removes @a the_thread its thread queue
* and cancels any timeouts associated with this blocking.
*
- * @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
* @param[in] return_code specifies the status to be returned.
@@ -105,9 +100,8 @@ void _Thread_queue_Extract(
* + single case
*/
void _Thread_queue_Extract_with_return_code(
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- uint32_t return_code
+ Thread_Control *the_thread,
+ uint32_t return_code
);
/**
diff --git a/cpukit/score/src/corerwlockrelease.c b/cpukit/score/src/corerwlockrelease.c
index efaf67d..bd39213 100644
--- a/cpukit/score/src/corerwlockrelease.c
+++ b/cpukit/score/src/corerwlockrelease.c
@@ -87,7 +87,7 @@ CORE_RWLock_Status _CORE_RWLock_Release(
next->Wait.option == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE )
return CORE_RWLOCK_SUCCESSFUL;
the_rwlock->number_of_readers += 1;
- _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
+ _Thread_queue_Extract( next );
}
}
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 9b623b2..424bcb4 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -262,7 +262,7 @@ Thread_Control *_MPCI_Process_response (
the_thread = NULL; /* IMPOSSIBLE */
break;
case OBJECTS_LOCAL:
- _Thread_queue_Extract( &_MPCI_Remote_blocked_threads, the_thread );
+ _Thread_queue_Extract( the_thread );
the_thread->Wait.return_code = the_packet->return_code;
_Objects_Put_without_thread_dispatch( &the_thread->Object );
break;
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 5c23756..0e16f59 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -185,11 +185,11 @@ void _Thread_queue_Enqueue(
}
void _Thread_queue_Extract_with_return_code(
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread,
- uint32_t return_code
+ Thread_Control *the_thread,
+ uint32_t return_code
)
{
+ Thread_queue_Control *the_thread_queue;
ISR_lock_Context lock_context;
_Thread_queue_Acquire( &lock_context );
@@ -199,6 +199,8 @@ void _Thread_queue_Extract_with_return_code(
return;
}
+ the_thread_queue = the_thread->Wait.queue;
+
if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_FIFO ) {
_Chain_Extract_unprotected( &the_thread->Object.Node );
} else { /* must be THREAD_QUEUE_DISCIPLINE_PRIORITY */
@@ -220,13 +222,9 @@ void _Thread_queue_Extract_with_return_code(
_Thread_blocking_operation_Finalize( the_thread, &lock_context );
}
-void _Thread_queue_Extract(
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread
-)
+void _Thread_queue_Extract( Thread_Control *the_thread )
{
_Thread_queue_Extract_with_return_code(
- the_thread_queue,
the_thread,
the_thread->Wait.return_code
);
diff --git a/cpukit/score/src/threadqextractwithproxy.c b/cpukit/score/src/threadqextractwithproxy.c
index fb06526..72043a0 100644
--- a/cpukit/score/src/threadqextractwithproxy.c
+++ b/cpukit/score/src/threadqextractwithproxy.c
@@ -31,8 +31,6 @@ void _Thread_queue_Extract_with_proxy(
Thread_Control *the_thread
)
{
- Thread_queue_Control *the_thread_queue;
-
#if defined(RTEMS_MULTIPROCESSING)
States_Control state;
@@ -50,8 +48,5 @@ void _Thread_queue_Extract_with_proxy(
}
#endif
- the_thread_queue = the_thread->Wait.queue;
- if ( the_thread_queue != NULL ) {
- _Thread_queue_Extract( the_thread_queue, the_thread );
- }
+ _Thread_queue_Extract( the_thread );
}
diff --git a/cpukit/score/src/threadqprocesstimeout.c b/cpukit/score/src/threadqprocesstimeout.c
index 6169019..dbb8f5c 100644
--- a/cpukit/score/src/threadqprocesstimeout.c
+++ b/cpukit/score/src/threadqprocesstimeout.c
@@ -69,7 +69,6 @@ void _Thread_queue_Process_timeout(
* queue initialization.
*/
_Thread_queue_Extract_with_return_code(
- the_thread_queue,
the_thread,
the_thread_queue->timeout_status
);
diff --git a/testsuites/sptests/spthreadq01/init.c b/testsuites/sptests/spthreadq01/init.c
index 240cd1a..5add92b 100644
--- a/testsuites/sptests/spthreadq01/init.c
+++ b/testsuites/sptests/spthreadq01/init.c
@@ -18,38 +18,17 @@
const char rtems_test_name[] = "SPTHREADQ 1";
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-void threadq_first_empty(
- const char *discipline_string,
- Thread_queue_Disciplines discipline
-);
-
-void threadq_first_empty(
- const char *discipline_string,
- Thread_queue_Disciplines discipline
+static rtems_task Init(
+ rtems_task_argument ignored
)
{
- Thread_queue_Control tq;
-
- printf( "Init - initialize thread queue for %s\n", discipline_string );
- _Thread_queue_Initialize( &tq, discipline, 3 );
+ TEST_BEGIN();
puts( "Init - _Thread_queue_Extract - thread not blocked on a thread queue" );
_Thread_Disable_dispatch();
- _Thread_queue_Extract( &tq, _Thread_Executing );
+ _Thread_queue_Extract( _Thread_Executing );
_Thread_Enable_dispatch();
/* is there more to check? */
-}
-
-rtems_task Init(
- rtems_task_argument ignored
-)
-{
- TEST_BEGIN();
-
- threadq_first_empty( "FIFO", THREAD_QUEUE_DISCIPLINE_FIFO );
- threadq_first_empty( "Priority", THREAD_QUEUE_DISCIPLINE_PRIORITY );
TEST_END();
rtems_test_exit(0);
--
1.8.4.5
More information about the devel
mailing list