summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-23 11:40:18 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-25 12:43:54 +0200
commit631b3c8967a329cdd53e54365e4e4c0aa93a4251 (patch)
tree3a750b145a90c90aa86222c26ee68aeb8c87a417 /cpukit/score/src
parentscore: Get rid of mp_id parameter (diff)
downloadrtems-631b3c8967a329cdd53e54365e4e4c0aa93a4251.tar.bz2
score: Move thread queue MP callout to context
Drop the multiprocessing (MP) dependent callout parameter from the thread queue extract, dequeue, flush and unblock methods. Merge this parameter with the lock context into new structure Thread_queue_Context. This helps to gets rid of the conditionally compiled method call helpers.
Diffstat (limited to '')
-rw-r--r--cpukit/score/src/apimutexlock.c9
-rw-r--r--cpukit/score/src/apimutexunlock.c15
-rw-r--r--cpukit/score/src/condition.c36
-rw-r--r--cpukit/score/src/corebarrier.c6
-rw-r--r--cpukit/score/src/corebarrierrelease.c10
-rw-r--r--cpukit/score/src/corebarrierwait.c21
-rw-r--r--cpukit/score/src/coremsgbroadcast.c18
-rw-r--r--cpukit/score/src/coremsgclose.c16
-rw-r--r--cpukit/score/src/coremsgflush.c6
-rw-r--r--cpukit/score/src/coremsgseize.c14
-rw-r--r--cpukit/score/src/coremsgsubmit.c26
-rw-r--r--cpukit/score/src/coremutex.c12
-rw-r--r--cpukit/score/src/coremutexsurrender.c27
-rw-r--r--cpukit/score/src/corerwlockobtainread.c20
-rw-r--r--cpukit/score/src/corerwlockobtainwrite.c18
-rw-r--r--cpukit/score/src/corerwlockrelease.c19
-rw-r--r--cpukit/score/src/coresem.c12
-rw-r--r--cpukit/score/src/futex.c31
-rw-r--r--cpukit/score/src/mpci.c19
-rw-r--r--cpukit/score/src/mutex.c49
-rw-r--r--cpukit/score/src/semaphore.c14
-rw-r--r--cpukit/score/src/threadqenqueue.c51
-rw-r--r--cpukit/score/src/threadqflush.c27
-rw-r--r--cpukit/score/src/threadrestart.c31
24 files changed, 244 insertions, 263 deletions
diff --git a/cpukit/score/src/apimutexlock.c b/cpukit/score/src/apimutexlock.c
index 79729d4d24..11d12c5a7e 100644
--- a/cpukit/score/src/apimutexlock.c
+++ b/cpukit/score/src/apimutexlock.c
@@ -25,20 +25,21 @@
void _API_Mutex_Lock( API_Mutex_Control *the_mutex )
{
- Thread_Life_state previous_thread_life_state;
- ISR_lock_Context lock_context;
+ Thread_Life_state previous_thread_life_state;
+ Thread_queue_Context queue_context;
previous_thread_life_state =
_Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
- _ISR_lock_ISR_disable( &lock_context );
+ _Thread_queue_Context_initialize( &queue_context, NULL );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
_CORE_mutex_Seize(
&the_mutex->Mutex,
_Thread_Executing,
true,
0,
- &lock_context
+ &queue_context
);
if ( the_mutex->Mutex.nest_count == 1 ) {
diff --git a/cpukit/score/src/apimutexunlock.c b/cpukit/score/src/apimutexunlock.c
index 082961f4fe..f0f114e0bf 100644
--- a/cpukit/score/src/apimutexunlock.c
+++ b/cpukit/score/src/apimutexunlock.c
@@ -24,19 +24,16 @@
void _API_Mutex_Unlock( API_Mutex_Control *the_mutex )
{
- ISR_lock_Context lock_context;
- Thread_Life_state previous_thread_life_state;
- bool restore_thread_life_protection;
+ Thread_queue_Context queue_context;
+ Thread_Life_state previous_thread_life_state;
+ bool restore_thread_life_protection;
previous_thread_life_state = the_mutex->previous_thread_life_state;
restore_thread_life_protection = the_mutex->Mutex.nest_count == 1;
- _ISR_lock_ISR_disable( &lock_context );
- _CORE_mutex_Surrender(
- &the_mutex->Mutex,
- NULL,
- &lock_context
- );
+ _Thread_queue_Context_initialize( &queue_context, NULL );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
+ _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
if ( restore_thread_life_protection ) {
_Thread_Set_life_protection( previous_thread_life_state );
diff --git a/cpukit/score/src/condition.c b/cpukit/score/src/condition.c
index fcd93b201b..c0320b28d4 100644
--- a/cpukit/score/src/condition.c
+++ b/cpukit/score/src/condition.c
@@ -220,54 +220,54 @@ int _Condition_Wait_recursive_timed(
}
typedef struct {
- ISR_lock_Context Base;
- int count;
-} Condition_Lock_context;
+ Thread_queue_Context Base;
+ int count;
+} Condition_Context;
static Thread_Control *_Condition_Flush_filter(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
- Condition_Lock_context *condition_lock_context;
+ Condition_Context *context;
- condition_lock_context = (Condition_Lock_context *) lock_context;
+ context = (Condition_Context *) queue_context;
- if ( condition_lock_context->count <= 0 ) {
+ if ( context->count <= 0 ) {
return NULL;
}
- --condition_lock_context->count;
+ --context->count;
return the_thread;
}
static void _Condition_Wake( struct _Condition_Control *_condition, int count )
{
- Condition_Control *condition;
- Condition_Lock_context lock_context;
+ Condition_Control *condition;
+ Condition_Context context;
condition = _Condition_Get( _condition );
- _ISR_lock_ISR_disable( &lock_context.Base );
- _Condition_Queue_acquire_critical( condition, &lock_context.Base );
+ _Thread_queue_Context_initialize( &context.Base, NULL );
+ _ISR_lock_ISR_disable( &context.Base.Lock_context );
+ _Condition_Queue_acquire_critical( condition, &context.Base.Lock_context );
/*
* In common uses cases of condition variables there are normally no threads
* on the queue, so check this condition early.
*/
if ( __predict_true( _Thread_queue_Is_empty( &condition->Queue.Queue ) ) ) {
- _Condition_Queue_release( condition, &lock_context.Base );
+ _Condition_Queue_release( condition, &context.Base.Lock_context );
return;
}
- lock_context.count = count;
+ context.count = count;
_Thread_queue_Flush_critical(
&condition->Queue.Queue,
CONDITION_TQ_OPERATIONS,
_Condition_Flush_filter,
- NULL,
- &lock_context.Base
+ &context.Base
);
}
diff --git a/cpukit/score/src/corebarrier.c b/cpukit/score/src/corebarrier.c
index 3cb7906289..a32f88c46b 100644
--- a/cpukit/score/src/corebarrier.c
+++ b/cpukit/score/src/corebarrier.c
@@ -33,9 +33,9 @@ void _CORE_barrier_Initialize(
}
Thread_Control *_CORE_barrier_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_BARRIER_WAS_DELETED;
diff --git a/cpukit/score/src/corebarrierrelease.c b/cpukit/score/src/corebarrierrelease.c
index c9c80f47dd..8a23856d53 100644
--- a/cpukit/score/src/corebarrierrelease.c
+++ b/cpukit/score/src/corebarrierrelease.c
@@ -21,13 +21,10 @@
#include <rtems/score/corebarrierimpl.h>
-uint32_t _CORE_barrier_Do_surrender(
+uint32_t _CORE_barrier_Do_flush(
CORE_barrier_Control *the_barrier,
Thread_queue_Flush_filter filter,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
the_barrier->number_of_waiting_threads = 0;
@@ -35,7 +32,6 @@ uint32_t _CORE_barrier_Do_surrender(
&the_barrier->Wait_queue.Queue,
CORE_BARRIER_TQ_OPERATIONS,
filter,
- mp_callout,
- lock_context
+ queue_context
);
}
diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c
index 54e90965f0..33f1718a66 100644
--- a/cpukit/score/src/corebarrierwait.c
+++ b/cpukit/score/src/corebarrierwait.c
@@ -21,22 +21,19 @@
#include <rtems/score/corebarrierimpl.h>
#include <rtems/score/statesimpl.h>
-void _CORE_barrier_Do_seize(
- CORE_barrier_Control *the_barrier,
- Thread_Control *executing,
- bool wait,
- Watchdog_Interval timeout,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+void _CORE_barrier_Seize(
+ CORE_barrier_Control *the_barrier,
+ Thread_Control *executing,
+ bool wait,
+ Watchdog_Interval timeout,
+ Thread_queue_Context *queue_context
)
{
uint32_t number_of_waiting_threads;
executing->Wait.return_code = CORE_BARRIER_STATUS_SUCCESSFUL;
- _CORE_barrier_Acquire_critical( the_barrier, lock_context );
+ _CORE_barrier_Acquire_critical( the_barrier, queue_context );
number_of_waiting_threads = the_barrier->number_of_waiting_threads;
++number_of_waiting_threads;
@@ -46,7 +43,7 @@ void _CORE_barrier_Do_seize(
&& number_of_waiting_threads == the_barrier->Attributes.maximum_count
) {
executing->Wait.return_code = CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED;
- _CORE_barrier_Surrender( the_barrier, mp_callout, lock_context );
+ _CORE_barrier_Surrender( the_barrier, queue_context );
} else {
the_barrier->number_of_waiting_threads = number_of_waiting_threads;
_Thread_queue_Enqueue_critical(
@@ -56,7 +53,7 @@ void _CORE_barrier_Do_seize(
STATES_WAITING_FOR_BARRIER,
timeout,
CORE_BARRIER_TIMEOUT,
- lock_context
+ &queue_context->Lock_context
);
}
}
diff --git a/cpukit/score/src/coremsgbroadcast.c b/cpukit/score/src/coremsgbroadcast.c
index a7a962f16f..23dd343c05 100644
--- a/cpukit/score/src/coremsgbroadcast.c
+++ b/cpukit/score/src/coremsgbroadcast.c
@@ -21,28 +21,25 @@
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/objectimpl.h>
-CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
+CORE_message_queue_Status _CORE_message_queue_Broadcast(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
uint32_t *count,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
Thread_Control *the_thread;
uint32_t number_broadcasted;
if ( size > the_message_queue->maximum_message_size ) {
- _ISR_lock_ISR_enable( lock_context );
+ _ISR_lock_ISR_enable( &queue_context->Lock_context );
return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
}
number_broadcasted = 0;
- _CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
+ _CORE_message_queue_Acquire_critical( the_message_queue, queue_context );
while (
( the_thread =
@@ -50,18 +47,17 @@ CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
the_message_queue,
buffer,
size,
- mp_callout,
0,
- lock_context
+ queue_context
)
)
) {
number_broadcasted += 1;
- _CORE_message_queue_Acquire( the_message_queue, lock_context );
+ _CORE_message_queue_Acquire( the_message_queue, queue_context );
}
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
*count = number_broadcasted;
return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index 1951e9ffd1..e24d756002 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -22,9 +22,9 @@
#include <rtems/score/wkspace.h>
static Thread_Control *_CORE_message_queue_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED;
@@ -32,12 +32,9 @@ static Thread_Control *_CORE_message_queue_Was_deleted(
return the_thread;
}
-void _CORE_message_queue_Do_close(
+void _CORE_message_queue_Close(
CORE_message_queue_Control *the_message_queue,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
@@ -50,8 +47,7 @@ void _CORE_message_queue_Do_close(
&the_message_queue->Wait_queue.Queue,
the_message_queue->operations,
_CORE_message_queue_Was_deleted,
- mp_callout,
- lock_context
+ queue_context
);
(void) _Workspace_Free( the_message_queue->message_buffers );
diff --git a/cpukit/score/src/coremsgflush.c b/cpukit/score/src/coremsgflush.c
index 38f26b7b87..e5b51f9306 100644
--- a/cpukit/score/src/coremsgflush.c
+++ b/cpukit/score/src/coremsgflush.c
@@ -23,7 +23,7 @@
uint32_t _CORE_message_queue_Flush(
CORE_message_queue_Control *the_message_queue,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
Chain_Node *inactive_head;
@@ -59,7 +59,7 @@ uint32_t _CORE_message_queue_Flush(
* fixed execution time that only deals with pending messages.
*/
- _CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
+ _CORE_message_queue_Acquire_critical( the_message_queue, queue_context );
count = the_message_queue->number_of_pending_messages;
if ( count != 0 ) {
@@ -78,6 +78,6 @@ uint32_t _CORE_message_queue_Flush(
_Chain_Initialize_empty( &the_message_queue->Pending_messages );
}
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return count;
}
diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c
index fcc95a7d28..b05ddd63f3 100644
--- a/cpukit/score/src/coremsgseize.c
+++ b/cpukit/score/src/coremsgseize.c
@@ -24,7 +24,6 @@
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/thread.h>
#include <rtems/score/statesimpl.h>
-#include <rtems/score/wkspace.h>
void _CORE_message_queue_Seize(
CORE_message_queue_Control *the_message_queue,
@@ -33,7 +32,7 @@ void _CORE_message_queue_Seize(
size_t *size_p,
bool wait,
Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
CORE_message_queue_Buffer_control *the_message;
@@ -58,7 +57,7 @@ void _CORE_message_queue_Seize(
* So return immediately.
*/
_CORE_message_queue_Free_message_buffer(the_message_queue, the_message);
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return;
#else
{
@@ -80,7 +79,7 @@ void _CORE_message_queue_Seize(
the_message_queue,
the_message
);
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return;
}
@@ -100,8 +99,7 @@ void _CORE_message_queue_Seize(
&the_message_queue->Wait_queue.Queue,
the_message_queue->operations,
the_thread,
- NULL,
- lock_context
+ queue_context
);
return;
}
@@ -109,7 +107,7 @@ void _CORE_message_queue_Seize(
}
if ( !wait ) {
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT;
return;
}
@@ -125,6 +123,6 @@ void _CORE_message_queue_Seize(
STATES_WAITING_FOR_MESSAGE,
timeout,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
- lock_context
+ &queue_context->Lock_context
);
}
diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c
index 68067cccb6..a86774175f 100644
--- a/cpukit/score/src/coremsgsubmit.c
+++ b/cpukit/score/src/coremsgsubmit.c
@@ -25,25 +25,22 @@
#include <rtems/score/statesimpl.h>
#include <rtems/score/wkspace.h>
-CORE_message_queue_Status _CORE_message_queue_Do_submit(
+CORE_message_queue_Status _CORE_message_queue_Submit(
CORE_message_queue_Control *the_message_queue,
Thread_Control *executing,
const void *buffer,
size_t size,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
CORE_message_queue_Submit_types submit_type,
bool wait,
Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
CORE_message_queue_Buffer_control *the_message;
Thread_Control *the_thread;
if ( size > the_message_queue->maximum_message_size ) {
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
}
@@ -55,9 +52,8 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
the_message_queue,
buffer,
size,
- mp_callout,
submit_type,
- lock_context
+ queue_context
);
if ( the_thread != NULL ) {
return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
@@ -90,20 +86,20 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
) {
( *the_message_queue->notify_handler )(
the_message_queue,
- lock_context
+ queue_context
);
} else {
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
}
#else
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
#endif
return CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
}
#if !defined(RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND)
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
#else
/*
@@ -112,7 +108,7 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
* on the queue.
*/
if ( !wait ) {
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
}
@@ -121,7 +117,7 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
* deadly to block in an ISR.
*/
if ( _ISR_Is_in_progress() ) {
- _CORE_message_queue_Release( the_message_queue, lock_context );
+ _CORE_message_queue_Release( the_message_queue, queue_context );
return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
}
@@ -143,7 +139,7 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
STATES_WAITING_FOR_MESSAGE,
timeout,
CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
- lock_context
+ &queue_context->Lock_context
);
return executing->Wait.return_code;
#endif
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index ea5e759dc4..ecca2441e0 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -92,9 +92,9 @@ CORE_mutex_Status _CORE_mutex_Initialize(
}
Thread_Control *_CORE_mutex_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_MUTEX_WAS_DELETED;
@@ -103,9 +103,9 @@ Thread_Control *_CORE_mutex_Was_deleted(
}
Thread_Control *_CORE_mutex_Unsatisfied_nowait(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c
index 746fee118e..040a580592 100644
--- a/cpukit/score/src/coremutexsurrender.c
+++ b/cpukit/score/src/coremutexsurrender.c
@@ -23,12 +23,9 @@
#include <rtems/score/coremuteximpl.h>
#include <rtems/score/thread.h>
-CORE_mutex_Status _CORE_mutex_Do_surrender(
- CORE_mutex_Control *the_mutex,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+CORE_mutex_Status _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
+ Thread_queue_Context *queue_context
)
{
Thread_Control *the_thread;
@@ -46,17 +43,17 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
if ( the_mutex->Attributes.only_owner_release ) {
if ( !_Thread_Is_executing( holder ) ) {
- _ISR_lock_ISR_enable( lock_context );
+ _ISR_lock_ISR_enable( &queue_context->Lock_context );
return CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE;
}
}
- _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Acquire_critical( the_mutex, queue_context );
/* XXX already unlocked -- not right status */
if ( !the_mutex->nest_count ) {
- _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Release( the_mutex, queue_context );
return CORE_MUTEX_STATUS_SUCCESSFUL;
}
@@ -71,12 +68,12 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
#if defined(RTEMS_DEBUG)
switch ( the_mutex->Attributes.lock_nesting_behavior ) {
case CORE_MUTEX_NESTING_ACQUIRES:
- _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Release( the_mutex, queue_context );
return CORE_MUTEX_STATUS_SUCCESSFUL;
#if defined(RTEMS_POSIX_API)
case CORE_MUTEX_NESTING_IS_ERROR:
/* should never occur */
- _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Release( the_mutex, queue_context );
return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
#endif
case CORE_MUTEX_NESTING_BLOCKS:
@@ -84,7 +81,7 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
break;
}
#else
- _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Release( the_mutex, queue_context );
/* must be CORE_MUTEX_NESTING_ACQUIRES or we wouldn't be here */
return CORE_MUTEX_STATUS_SUCCESSFUL;
#endif
@@ -126,7 +123,7 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
&the_mutex->Wait_queue.Queue,
the_mutex->operations,
the_thread,
- mp_callout
+ queue_context
);
#if defined(RTEMS_MULTIPROCESSING)
@@ -155,10 +152,10 @@ CORE_mutex_Status _CORE_mutex_Do_surrender(
unblock,
&the_mutex->Wait_queue.Queue,
the_thread,
- lock_context
+ &queue_context->Lock_context
);
} else {
- _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
+ _CORE_mutex_Release( the_mutex, queue_context );
}
/*
diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c
index fcbaf4a829..639ea7052d 100644
--- a/cpukit/score/src/corerwlockobtainread.c
+++ b/cpukit/score/src/corerwlockobtainread.c
@@ -24,11 +24,11 @@
#include <rtems/score/watchdog.h>
void _CORE_RWLock_Seize_for_reading(
- CORE_RWLock_Control *the_rwlock,
- Thread_Control *executing,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
+ CORE_RWLock_Control *the_rwlock,
+ Thread_Control *executing,
+ bool wait,
+ Watchdog_Interval timeout,
+ Thread_queue_Context *queue_context
)
{
/*
@@ -37,13 +37,13 @@ void _CORE_RWLock_Seize_for_reading(
* If any thread is waiting, then we wait.
*/
- _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
+ _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
switch ( the_rwlock->current_state ) {
case CORE_RWLOCK_UNLOCKED:
the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_READING;
the_rwlock->number_of_readers += 1;
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
return;
@@ -55,7 +55,7 @@ void _CORE_RWLock_Seize_for_reading(
);
if ( !waiter ) {
the_rwlock->number_of_readers += 1;
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
return;
}
@@ -70,7 +70,7 @@ void _CORE_RWLock_Seize_for_reading(
*/
if ( !wait ) {
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
return;
}
@@ -89,6 +89,6 @@ void _CORE_RWLock_Seize_for_reading(
STATES_WAITING_FOR_RWLOCK,
timeout,
CORE_RWLOCK_TIMEOUT,
- lock_context
+ &queue_context->Lock_context
);
}
diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c
index e1bb1bd14a..a7d1bb1b6a 100644
--- a/cpukit/score/src/corerwlockobtainwrite.c
+++ b/cpukit/score/src/corerwlockobtainwrite.c
@@ -24,11 +24,11 @@
#include <rtems/score/watchdog.h>
void _CORE_RWLock_Seize_for_writing(
- CORE_RWLock_Control *the_rwlock,
- Thread_Control *executing,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
+ CORE_RWLock_Control *the_rwlock,
+ Thread_Control *executing,
+ bool wait,
+ Watchdog_Interval timeout,
+ Thread_queue_Context *queue_context
)
{
/*
@@ -38,12 +38,12 @@ void _CORE_RWLock_Seize_for_writing(
* If any thread is waiting, then we wait.
*/
- _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
+ _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
switch ( the_rwlock->current_state ) {
case CORE_RWLOCK_UNLOCKED:
the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
return;
@@ -57,7 +57,7 @@ void _CORE_RWLock_Seize_for_writing(
*/
if ( !wait ) {
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
return;
}
@@ -76,6 +76,6 @@ void _CORE_RWLock_Seize_for_writing(
STATES_WAITING_FOR_RWLOCK,
timeout,
CORE_RWLOCK_TIMEOUT,
- lock_context
+ &queue_context->Lock_context
);
}
diff --git a/cpukit/score/src/corerwlockrelease.c b/cpukit/score/src/corerwlockrelease.c
index 6f76aad3e5..81e01d1b67 100644
--- a/cpukit/score/src/corerwlockrelease.c
+++ b/cpukit/score/src/corerwlockrelease.c
@@ -35,9 +35,9 @@ static bool _CORE_RWLock_Is_waiting_for_reading(
}
static Thread_Control *_CORE_RWLock_Flush_filter(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
CORE_RWLock_Control *the_rwlock;
@@ -74,8 +74,8 @@ static Thread_Control *_CORE_RWLock_Flush_filter(
}
CORE_RWLock_Status _CORE_RWLock_Surrender(
- CORE_RWLock_Control *the_rwlock,
- ISR_lock_Context *lock_context
+ CORE_RWLock_Control *the_rwlock,
+ Thread_queue_Context *queue_context
)
{
/*
@@ -85,11 +85,11 @@ CORE_RWLock_Status _CORE_RWLock_Surrender(
* If any thread is waiting, then we wait.
*/
- _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
+ _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
if ( the_rwlock->current_state == CORE_RWLOCK_UNLOCKED){
/* This is an error at the caller site */
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
return CORE_RWLOCK_SUCCESSFUL;
}
@@ -98,7 +98,7 @@ CORE_RWLock_Status _CORE_RWLock_Surrender(
if ( the_rwlock->number_of_readers != 0 ) {
/* must be unlocked again */
- _CORE_RWLock_Release( the_rwlock, lock_context );
+ _CORE_RWLock_Release( the_rwlock, queue_context );
return CORE_RWLOCK_SUCCESSFUL;
}
}
@@ -119,8 +119,7 @@ CORE_RWLock_Status _CORE_RWLock_Surrender(
&the_rwlock->Wait_queue.Queue,
CORE_RWLOCK_TQ_OPERATIONS,
_CORE_RWLock_Flush_filter,
- NULL,
- lock_context
+ queue_context
);
return CORE_RWLOCK_SUCCESSFUL;
}
diff --git a/cpukit/score/src/coresem.c b/cpukit/score/src/coresem.c
index 02a3837410..c94f2b7e86 100644
--- a/cpukit/score/src/coresem.c
+++ b/cpukit/score/src/coresem.c
@@ -38,9 +38,9 @@ void _CORE_semaphore_Initialize(
}
Thread_Control *_CORE_semaphore_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_SEMAPHORE_WAS_DELETED;
@@ -49,9 +49,9 @@ Thread_Control *_CORE_semaphore_Was_deleted(
}
Thread_Control *_CORE_semaphore_Unsatisfied_nowait(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
the_thread->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
diff --git a/cpukit/score/src/futex.c b/cpukit/score/src/futex.c
index 66085a8a0a..d7945d12ee 100644
--- a/cpukit/score/src/futex.c
+++ b/cpukit/score/src/futex.c
@@ -104,25 +104,25 @@ int _Futex_Wait( struct _Futex_Control *_futex, int *uaddr, int val )
}
typedef struct {
- ISR_lock_Context Base;
- int count;
-} Futex_Lock_context;
+ Thread_queue_Context Base;
+ int count;
+} Futex_Context;
static Thread_Control *_Futex_Flush_filter(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
- Futex_Lock_context *futex_lock_context;
+ Futex_Context *context;
- futex_lock_context = (Futex_Lock_context *) lock_context;
+ context = (Futex_Context *) queue_context;
- if ( futex_lock_context->count <= 0 ) {
+ if ( context->count <= 0 ) {
return NULL;
}
- --futex_lock_context->count;
+ --context->count;
return the_thread;
}
@@ -130,10 +130,10 @@ static Thread_Control *_Futex_Flush_filter(
int _Futex_Wake( struct _Futex_Control *_futex, int count )
{
Futex_Control *futex;
- Futex_Lock_context lock_context;
+ Futex_Context context;
futex = _Futex_Get( _futex );
- _Futex_Queue_acquire( futex, &lock_context.Base );
+ _Futex_Queue_acquire( futex, &context.Base.Lock_context );
/*
* For some synchronization objects like barriers the _Futex_Wake() must be
@@ -141,17 +141,16 @@ int _Futex_Wake( struct _Futex_Control *_futex, int count )
* check this condition early.
*/
if ( __predict_true( _Thread_queue_Is_empty( &futex->Queue.Queue ) ) ) {
- _Futex_Queue_release( futex, &lock_context.Base );
+ _Futex_Queue_release( futex, &context.Base.Lock_context );
return 0;
}
- lock_context.count = count;
+ context.count = count;
return (int) _Thread_queue_Flush_critical(
&futex->Queue.Queue,
FUTEX_TQ_OPERATIONS,
_Futex_Flush_filter,
- NULL,
- &lock_context.Base
+ &context.Base
);
}
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 0b51e382e3..4022a800f1 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -321,24 +321,25 @@ void _MPCI_Receive_server(
)
{
- MP_packet_Prefix *the_packet;
- MPCI_Packet_processor the_function;
- Thread_Control *executing;
- ISR_lock_Context lock_context;
+ MP_packet_Prefix *the_packet;
+ MPCI_Packet_processor the_function;
+ Thread_Control *executing;
+ Thread_queue_Context queue_context;
executing = _Thread_Get_executing();
+ _Thread_queue_Context_initialize( &queue_context, NULL );
for ( ; ; ) {
executing->receive_packet = NULL;
- _ISR_lock_ISR_disable( &lock_context );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
_CORE_semaphore_Seize(
&_MPCI_Semaphore,
executing,
true,
WATCHDOG_NO_TIMEOUT,
- &lock_context
+ &queue_context
);
for ( ; ; ) {
@@ -370,10 +371,10 @@ void _MPCI_Receive_server(
void _MPCI_Announce ( void )
{
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
- _ISR_lock_ISR_disable( &lock_context );
- (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, &lock_context );
+ _ISR_lock_ISR_disable( &queue_context.Lock_context );
+ (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, &queue_context );
}
void _MPCI_Internal_packets_Send_process_packet (
diff --git a/cpukit/score/src/mutex.c b/cpukit/score/src/mutex.c
index e27075ed8b..0b12232145 100644
--- a/cpukit/score/src/mutex.c
+++ b/cpukit/score/src/mutex.c
@@ -125,11 +125,11 @@ static void _Mutex_Acquire_slow(
}
static void _Mutex_Release_slow(
- Mutex_Control *mutex,
- Thread_Control *executing,
- Thread_queue_Heads *heads,
- bool keep_priority,
- ISR_lock_Context *lock_context
+ Mutex_Control *mutex,
+ Thread_Control *executing,
+ Thread_queue_Heads *heads,
+ bool keep_priority,
+ Thread_queue_Context *queue_context
)
{
if (heads != NULL) {
@@ -146,17 +146,17 @@ static void _Mutex_Release_slow(
&mutex->Queue.Queue,
operations,
first,
- NULL
+ queue_context
);
_Thread_queue_Boost_priority( &mutex->Queue.Queue, first );
_Thread_queue_Unblock_critical(
unblock,
&mutex->Queue.Queue,
first,
- lock_context
+ &queue_context->Lock_context
);
} else {
- _Mutex_Queue_release( mutex, lock_context);
+ _Mutex_Queue_release( mutex, &queue_context->Lock_context );
}
if ( !keep_priority ) {
@@ -169,9 +169,9 @@ static void _Mutex_Release_slow(
}
static void _Mutex_Release_critical(
- Mutex_Control *mutex,
- Thread_Control *executing,
- ISR_lock_Context *lock_context
+ Mutex_Control *mutex,
+ Thread_Control *executing,
+ Thread_queue_Context *queue_context
)
{
Thread_queue_Heads *heads;
@@ -193,14 +193,14 @@ static void _Mutex_Release_critical(
|| !executing->priority_restore_hint;
if ( __predict_true( heads == NULL && keep_priority ) ) {
- _Mutex_Queue_release( mutex, lock_context );
+ _Mutex_Queue_release( mutex, &queue_context->Lock_context );
} else {
_Mutex_Release_slow(
mutex,
executing,
heads,
keep_priority,
- lock_context
+ queue_context
);
}
}
@@ -297,16 +297,17 @@ int _Mutex_Try_acquire( struct _Mutex_Control *_mutex )
void _Mutex_Release( struct _Mutex_Control *_mutex )
{
- Mutex_Control *mutex;
- ISR_lock_Context lock_context;
- Thread_Control *executing;
+ Mutex_Control *mutex;
+ Thread_queue_Context queue_context;
+ Thread_Control *executing;
mutex = _Mutex_Get( _mutex );
- executing = _Mutex_Queue_acquire( mutex, &lock_context );
+ _Thread_queue_Context_initialize( &queue_context, NULL );
+ executing = _Mutex_Queue_acquire( mutex, &queue_context.Lock_context );
_Assert( mutex->owner == executing );
- _Mutex_Release_critical( mutex, executing, &lock_context );
+ _Mutex_Release_critical( mutex, executing, &queue_context );
}
static Mutex_recursive_Control *_Mutex_recursive_Get(
@@ -426,23 +427,27 @@ int _Mutex_recursive_Try_acquire( struct _Mutex_recursive_Control *_mutex )
void _Mutex_recursive_Release( struct _Mutex_recursive_Control *_mutex )
{
Mutex_recursive_Control *mutex;
- ISR_lock_Context lock_context;
+ Thread_queue_Context queue_context;
Thread_Control *executing;
unsigned int nest_level;
mutex = _Mutex_recursive_Get( _mutex );
- executing = _Mutex_Queue_acquire( &mutex->Mutex, &lock_context );
+ _Thread_queue_Context_initialize( &queue_context, NULL );
+ executing = _Mutex_Queue_acquire(
+ &mutex->Mutex,
+ &queue_context.Lock_context
+ );
_Assert( mutex->Mutex.owner == executing );
nest_level = mutex->nest_level;
if ( __predict_true( nest_level == 0 ) ) {
- _Mutex_Release_critical( &mutex->Mutex, executing, &lock_context );
+ _Mutex_Release_critical( &mutex->Mutex, executing, &queue_context );
} else {
mutex->nest_level = nest_level - 1;
- _Mutex_Queue_release( &mutex->Mutex, &lock_context );
+ _Mutex_Queue_release( &mutex->Mutex, &queue_context.Lock_context );
}
}
diff --git a/cpukit/score/src/semaphore.c b/cpukit/score/src/semaphore.c
index 4e70b79a6a..3d0d5f53ab 100644
--- a/cpukit/score/src/semaphore.c
+++ b/cpukit/score/src/semaphore.c
@@ -110,18 +110,19 @@ void _Semaphore_Wait( struct _Semaphore_Control *_sem )
void _Semaphore_Post( struct _Semaphore_Control *_sem )
{
- Semaphore_Control *sem;
- ISR_lock_Context lock_context;
- Thread_queue_Heads *heads;
+ Semaphore_Control *sem;
+ Thread_queue_Context queue_context;
+ Thread_queue_Heads *heads;
sem = _Semaphore_Get( _sem );
- _Semaphore_Queue_acquire( sem, &lock_context );
+ _Thread_queue_Context_initialize( &queue_context, NULL );
+ _Semaphore_Queue_acquire( sem, &queue_context.Lock_context );
heads = sem->Queue.Queue.heads;
if ( heads == NULL ) {
_Assert( sem->count < UINT_MAX );
++sem->count;
- _Semaphore_Queue_release( sem, &lock_context );
+ _Semaphore_Queue_release( sem, &queue_context.Lock_context );
} else {
const Thread_queue_Operations *operations;
Thread_Control *first;
@@ -133,8 +134,7 @@ void _Semaphore_Post( struct _Semaphore_Control *_sem )
&sem->Queue.Queue,
operations,
first,
- NULL,
- &lock_context
+ &queue_context
);
}
}
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index cda7c86efb..a1a37e1ed1 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -99,7 +99,7 @@ bool _Thread_queue_Do_extract_locked(
Thread_Control *the_thread
#if defined(RTEMS_MULTIPROCESSING)
,
- Thread_queue_MP_callout mp_callout
+ const Thread_queue_Context *queue_context
#endif
)
{
@@ -108,12 +108,13 @@ bool _Thread_queue_Do_extract_locked(
#if defined(RTEMS_MULTIPROCESSING)
if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
- Thread_Proxy_control *the_proxy;
-
- _Assert( mp_callout != NULL );
+ Thread_Proxy_control *the_proxy;
+ Thread_queue_MP_callout mp_callout;
the_proxy = (Thread_Proxy_control *) the_thread;
- the_proxy->thread_queue_callout = mp_callout;
+ mp_callout = queue_context->mp_callout;
+ _Assert( mp_callout != NULL );
+ the_proxy->thread_queue_callout = queue_context->mp_callout;
}
#endif
@@ -164,14 +165,11 @@ void _Thread_queue_Unblock_critical(
}
}
-void _Thread_queue_Do_extract_critical(
+void _Thread_queue_Extract_critical(
Thread_queue_Queue *queue,
const Thread_queue_Operations *operations,
Thread_Control *the_thread,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
bool unblock;
@@ -180,24 +178,28 @@ void _Thread_queue_Do_extract_critical(
queue,
operations,
the_thread,
- mp_callout
+ queue_context
);
_Thread_queue_Unblock_critical(
unblock,
queue,
the_thread,
- lock_context
+ &queue_context->Lock_context
);
}
void _Thread_queue_Extract( Thread_Control *the_thread )
{
- ISR_lock_Context lock_context;
- void *lock;
- Thread_queue_Queue *queue;
+ Thread_queue_Context queue_context;
+ void *lock;
+ Thread_queue_Queue *queue;
- lock = _Thread_Lock_acquire( the_thread, &lock_context );
+ _Thread_queue_Context_initialize(
+ &queue_context,
+ _Thread_queue_MP_callout_do_nothing
+ );
+ lock = _Thread_Lock_acquire( the_thread, &queue_context.Lock_context );
queue = the_thread->Wait.queue;
@@ -208,11 +210,10 @@ void _Thread_queue_Extract( Thread_Control *the_thread )
queue,
the_thread->Wait.operations,
the_thread,
- _Thread_queue_MP_callout_do_nothing,
- &lock_context
+ &queue_context
);
} else {
- _Thread_Lock_release( lock, &lock_context );
+ _Thread_Lock_release( lock, &queue_context.Lock_context );
}
}
@@ -225,10 +226,11 @@ Thread_Control *_Thread_queue_Do_dequeue(
#endif
)
{
- ISR_lock_Context lock_context;
- Thread_Control *the_thread;
+ Thread_queue_Context queue_context;
+ Thread_Control *the_thread;
- _Thread_queue_Acquire( the_thread_queue, &lock_context );
+ _Thread_queue_Context_initialize( &queue_context, mp_callout );
+ _Thread_queue_Acquire( the_thread_queue, &queue_context.Lock_context );
the_thread = _Thread_queue_First_locked( the_thread_queue, operations );
@@ -239,11 +241,10 @@ Thread_Control *_Thread_queue_Do_dequeue(
&the_thread_queue->Queue,
operations,
the_thread,
- mp_callout,
- &lock_context
+ &queue_context
);
} else {
- _Thread_queue_Release( the_thread_queue, &lock_context );
+ _Thread_queue_Release( the_thread_queue, &queue_context.Lock_context );
}
return the_thread;
diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c
index 0413388f5d..8b23194357 100644
--- a/cpukit/score/src/threadqflush.c
+++ b/cpukit/score/src/threadqflush.c
@@ -21,24 +21,21 @@
#include <rtems/score/threadimpl.h>
Thread_Control *_Thread_queue_Flush_default_filter(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
(void) queue;
- (void) lock_context;
+ (void) queue_context;
return the_thread;
}
-size_t _Thread_queue_Do_flush_critical(
+size_t _Thread_queue_Flush_critical(
Thread_queue_Queue *queue,
const Thread_queue_Operations *operations,
Thread_queue_Flush_filter filter,
-#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_MP_callout mp_callout,
-#endif
- ISR_lock_Context *lock_context
+ Thread_queue_Context *queue_context
)
{
size_t flushed;
@@ -60,7 +57,7 @@ size_t _Thread_queue_Do_flush_critical(
}
first = ( *operations->first )( heads );
- first = ( *filter )( first, queue, lock_context );
+ first = ( *filter )( first, queue, queue_context );
if ( first == NULL ) {
break;
}
@@ -69,7 +66,7 @@ size_t _Thread_queue_Do_flush_critical(
queue,
operations,
first,
- mp_callout
+ queue_context
);
if ( do_unblock ) {
_Chain_Append_unprotected( &unblock, &first->Wait.Node.Chain );
@@ -84,8 +81,10 @@ size_t _Thread_queue_Do_flush_critical(
if ( node != tail ) {
Per_CPU_Control *cpu_self;
- cpu_self = _Thread_Dispatch_disable_critical( lock_context );
- _Thread_queue_Queue_release( queue, lock_context );
+ cpu_self = _Thread_Dispatch_disable_critical(
+ &queue_context->Lock_context
+ );
+ _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
do {
Thread_Control *the_thread;
@@ -100,7 +99,7 @@ size_t _Thread_queue_Do_flush_critical(
_Thread_Dispatch_enable( cpu_self );
} else {
- _Thread_queue_Queue_release( queue, lock_context );
+ _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
}
return flushed;
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 30536f748a..52d68de69a 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -87,24 +87,24 @@ static void _Thread_Raise_real_priority(
}
typedef struct {
- ISR_lock_Context Base;
+ Thread_queue_Context Base;
#if defined(RTEMS_POSIX_API)
- void *exit_value;
+ void *exit_value;
#endif
-} Thread_Join_lock_context;
+} Thread_Join_context;
#if defined(RTEMS_POSIX_API)
static Thread_Control *_Thread_Join_flush_filter(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- ISR_lock_Context *lock_context
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
)
{
- Thread_Join_lock_context *join_lock_context;
+ Thread_Join_context *join_context;
- join_lock_context = (Thread_Join_lock_context *) lock_context;
+ join_context = (Thread_Join_context *) queue_context;
- the_thread->Wait.return_argument = join_lock_context->exit_value;
+ the_thread->Wait.return_argument = join_context->exit_value;
return the_thread;
}
@@ -112,13 +112,17 @@ static Thread_Control *_Thread_Join_flush_filter(
static void _Thread_Wake_up_joining_threads( Thread_Control *the_thread )
{
- Thread_Join_lock_context join_lock_context;
+ Thread_Join_context join_context;
#if defined(RTEMS_POSIX_API)
- join_lock_context.exit_value = the_thread->Life.exit_value;
+ join_context.exit_value = the_thread->Life.exit_value;
#endif
- _Thread_State_acquire( the_thread, &join_lock_context.Base );
+ _Thread_queue_Context_initialize( &join_context.Base, NULL );
+ _Thread_queue_Acquire(
+ &the_thread->Join_queue,
+ &join_context.Base.Lock_context
+ );
_Thread_queue_Flush_critical(
&the_thread->Join_queue.Queue,
THREAD_JOIN_TQ_OPERATIONS,
@@ -127,8 +131,7 @@ static void _Thread_Wake_up_joining_threads( Thread_Control *the_thread )
#else
_Thread_queue_Flush_default_filter,
#endif
- NULL,
- &join_lock_context.Base
+ &join_context.Base
);
}