mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 07:25:26 +08:00
score: Add _Thread_queue_Context_set_MP_callout()
Add _Thread_queue_Context_set_MP_callout() to simplify _Thread_queue_Context_initialize(). This makes it possible to more easily add additional fields to Thread_queue_Context.
This commit is contained in:
@@ -375,7 +375,7 @@ rtems_bsdnet_semaphore_obtain (void)
|
||||
Status_Control status;
|
||||
if (!the_networkSemaphore)
|
||||
rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
|
||||
_Thread_queue_Context_initialize(&queue_context, NULL);
|
||||
_Thread_queue_Context_initialize(&queue_context);
|
||||
_ISR_lock_ISR_disable(&queue_context.Lock_context);
|
||||
status = _CORE_mutex_Seize (
|
||||
&the_networkSemaphore->Core_control.mutex,
|
||||
@@ -408,7 +408,7 @@ rtems_bsdnet_semaphore_release (void)
|
||||
|
||||
if (!the_networkSemaphore)
|
||||
rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
|
||||
_Thread_queue_Context_initialize(&queue_context, NULL);
|
||||
_Thread_queue_Context_initialize(&queue_context);
|
||||
_ISR_lock_ISR_disable(&queue_context.Lock_context);
|
||||
status = _CORE_mutex_Surrender (
|
||||
&the_networkSemaphore->Core_control.mutex,
|
||||
|
||||
@@ -68,7 +68,7 @@ RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get(
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (POSIX_Barrier_Control *) _Objects_Get(
|
||||
(Objects_Id) *barrier,
|
||||
&queue_context->Lock_context,
|
||||
|
||||
@@ -111,7 +111,7 @@ RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get(
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (POSIX_Message_queue_Control *) _Objects_Get(
|
||||
id,
|
||||
&queue_context->Lock_context,
|
||||
|
||||
@@ -59,7 +59,7 @@ RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get(
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (POSIX_Semaphore_Control *) _Objects_Get(
|
||||
(Objects_Id) *id,
|
||||
&queue_context->Lock_context,
|
||||
|
||||
@@ -74,7 +74,7 @@ RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get(
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (Barrier_Control *)
|
||||
_Objects_Get( id, &queue_context->Lock_context, &_Barrier_Information );
|
||||
}
|
||||
|
||||
@@ -87,16 +87,12 @@ RTEMS_INLINE_ROUTINE void _Message_queue_Free (
|
||||
_Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Do_get(
|
||||
Objects_Id id,
|
||||
Thread_queue_Context *queue_context
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
,
|
||||
Thread_queue_MP_callout mp_callout
|
||||
#endif
|
||||
RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get(
|
||||
Objects_Id id,
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, mp_callout );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (Message_queue_Control *) _Objects_Get(
|
||||
id,
|
||||
&queue_context->Lock_context,
|
||||
@@ -104,14 +100,6 @@ RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Do_get(
|
||||
);
|
||||
}
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
#define _Message_queue_Get( id, queue_context, mp_callout ) \
|
||||
_Message_queue_Do_get( id, queue_context, mp_callout )
|
||||
#else
|
||||
#define _Message_queue_Get( id, queue_context, mp_callout ) \
|
||||
_Message_queue_Do_get( id, queue_context )
|
||||
#endif
|
||||
|
||||
RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Allocate( void )
|
||||
{
|
||||
return (Message_queue_Control *)
|
||||
|
||||
@@ -58,16 +58,12 @@ RTEMS_INLINE_ROUTINE void _Semaphore_Free (
|
||||
_Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
|
||||
}
|
||||
|
||||
RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Do_get(
|
||||
Objects_Id id,
|
||||
Thread_queue_Context *queue_context
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
,
|
||||
Thread_queue_MP_callout mp_callout
|
||||
#endif
|
||||
RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get(
|
||||
Objects_Id id,
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
_Thread_queue_Context_initialize( queue_context, mp_callout );
|
||||
_Thread_queue_Context_initialize( queue_context );
|
||||
return (Semaphore_Control *) _Objects_Get(
|
||||
id,
|
||||
&queue_context->Lock_context,
|
||||
@@ -75,14 +71,6 @@ RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Do_get(
|
||||
);
|
||||
}
|
||||
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
#define _Semaphore_Get( id, queue_context, mp_callout ) \
|
||||
_Semaphore_Do_get( id, queue_context, mp_callout )
|
||||
#else
|
||||
#define _Semaphore_Get( id, queue_context, mp_callout ) \
|
||||
_Semaphore_Do_get( id, queue_context )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -40,11 +40,7 @@ rtems_status_code rtems_message_queue_broadcast(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -54,6 +50,10 @@ rtems_status_code rtems_message_queue_broadcast(
|
||||
#endif
|
||||
}
|
||||
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
status = _CORE_message_queue_Broadcast(
|
||||
&the_message_queue->message_queue,
|
||||
buffer,
|
||||
|
||||
@@ -29,11 +29,7 @@ rtems_status_code rtems_message_queue_delete(
|
||||
Thread_queue_Context queue_context;
|
||||
|
||||
_Objects_Allocator_lock();
|
||||
the_message_queue = _Message_queue_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Message_queue_MP_Send_object_was_deleted
|
||||
);
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
_Objects_Allocator_unlock();
|
||||
@@ -54,6 +50,10 @@ rtems_status_code rtems_message_queue_delete(
|
||||
|
||||
_Objects_Close( &_Message_queue_Information, &the_message_queue->Object );
|
||||
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Message_queue_MP_Send_object_was_deleted
|
||||
);
|
||||
_CORE_message_queue_Close(
|
||||
&the_message_queue->message_queue,
|
||||
&queue_context
|
||||
|
||||
@@ -32,7 +32,7 @@ rtems_status_code rtems_message_queue_flush(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -32,7 +32,7 @@ rtems_status_code rtems_message_queue_get_number_pending(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -45,7 +45,7 @@ rtems_status_code rtems_message_queue_receive(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -35,11 +35,7 @@ rtems_status_code rtems_message_queue_send(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -53,6 +49,10 @@ rtems_status_code rtems_message_queue_send(
|
||||
&the_message_queue->message_queue,
|
||||
&queue_context
|
||||
);
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
status = _CORE_message_queue_Send(
|
||||
&the_message_queue->message_queue,
|
||||
buffer,
|
||||
|
||||
@@ -35,11 +35,7 @@ rtems_status_code rtems_message_queue_urgent(
|
||||
return RTEMS_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
the_message_queue = _Message_queue_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
the_message_queue = _Message_queue_Get( id, &queue_context );
|
||||
|
||||
if ( the_message_queue == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -53,6 +49,10 @@ rtems_status_code rtems_message_queue_urgent(
|
||||
&the_message_queue->message_queue,
|
||||
&queue_context
|
||||
);
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Message_queue_Core_message_queue_mp_support
|
||||
);
|
||||
status = _CORE_message_queue_Urgent(
|
||||
&the_message_queue->message_queue,
|
||||
buffer,
|
||||
|
||||
@@ -31,11 +31,7 @@ rtems_status_code rtems_semaphore_delete(
|
||||
rtems_attribute attribute_set;
|
||||
|
||||
_Objects_Allocator_lock();
|
||||
the_semaphore = _Semaphore_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Semaphore_MP_Send_object_was_deleted
|
||||
);
|
||||
the_semaphore = _Semaphore_Get( id, &queue_context );
|
||||
|
||||
if ( the_semaphore == NULL ) {
|
||||
_Objects_Allocator_unlock();
|
||||
|
||||
@@ -27,11 +27,7 @@ rtems_status_code rtems_semaphore_flush( rtems_id id )
|
||||
Thread_queue_Context queue_context;
|
||||
rtems_attribute attribute_set;
|
||||
|
||||
the_semaphore = _Semaphore_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Semaphore_MP_Send_object_was_deleted
|
||||
);
|
||||
the_semaphore = _Semaphore_Get( id, &queue_context );
|
||||
|
||||
if ( the_semaphore == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -45,6 +41,11 @@ rtems_status_code rtems_semaphore_flush( rtems_id id )
|
||||
|
||||
attribute_set = the_semaphore->attribute_set;
|
||||
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Semaphore_MP_Send_object_was_deleted
|
||||
);
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
|
||||
_ISR_lock_ISR_enable( &queue_context.Lock_context );
|
||||
|
||||
@@ -46,7 +46,7 @@ rtems_status_code rtems_semaphore_obtain(
|
||||
bool wait;
|
||||
Status_Control status;
|
||||
|
||||
the_semaphore = _Semaphore_Get( id, &queue_context, NULL );
|
||||
the_semaphore = _Semaphore_Get( id, &queue_context );
|
||||
|
||||
if ( the_semaphore == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -32,11 +32,7 @@ rtems_status_code rtems_semaphore_release( rtems_id id )
|
||||
rtems_attribute attribute_set;
|
||||
Status_Control status;
|
||||
|
||||
the_semaphore = _Semaphore_Get(
|
||||
id,
|
||||
&queue_context,
|
||||
_Semaphore_Core_mutex_mp_support
|
||||
);
|
||||
the_semaphore = _Semaphore_Get( id, &queue_context );
|
||||
|
||||
if ( the_semaphore == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
@@ -46,6 +42,11 @@ rtems_status_code rtems_semaphore_release( rtems_id id )
|
||||
#endif
|
||||
}
|
||||
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Semaphore_Core_mutex_mp_support
|
||||
);
|
||||
|
||||
attribute_set = the_semaphore->attribute_set;
|
||||
#if defined(RTEMS_SMP)
|
||||
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
|
||||
|
||||
@@ -103,7 +103,7 @@ rtems_status_code rtems_semaphore_set_priority(
|
||||
return RTEMS_INVALID_ID;
|
||||
}
|
||||
|
||||
the_semaphore = _Semaphore_Get( semaphore_id, &queue_context, NULL );
|
||||
the_semaphore = _Semaphore_Get( semaphore_id, &queue_context );
|
||||
|
||||
if ( the_semaphore == NULL ) {
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
|
||||
@@ -189,7 +189,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Timeout( Watchdog_Control *watchdog )
|
||||
Thread_Control *thread = rival->thread;
|
||||
Thread_queue_Context queue_context;
|
||||
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
_ISR_lock_ISR_disable( &queue_context.Lock_context );
|
||||
_MRSP_Acquire_critical( mrsp, &queue_context );
|
||||
|
||||
|
||||
@@ -63,7 +63,22 @@ typedef void ( *Thread_queue_MP_callout )(
|
||||
* @see _Thread_queue_Context_initialize().
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief The lock context for the thread queue acquire and release
|
||||
* operations.
|
||||
*/
|
||||
ISR_lock_Context Lock_context;
|
||||
|
||||
/**
|
||||
* @brief Callout to unblock the thread in case it is actually a thread
|
||||
* proxy.
|
||||
*
|
||||
* This field is only used on multiprocessing configurations. Used by
|
||||
* thread queue extract and unblock methods for objects with multiprocessing
|
||||
* (MP) support.
|
||||
*
|
||||
* @see _Thread_queue_Context_set_MP_callout().
|
||||
*/
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
Thread_queue_MP_callout mp_callout;
|
||||
#endif
|
||||
|
||||
@@ -53,47 +53,44 @@ typedef struct {
|
||||
Thread_queue_Queue Queue;
|
||||
} Thread_queue_Syslock_queue;
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Thread_queue_Do_context_initialize(
|
||||
Thread_queue_Context *queue_context
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
,
|
||||
Thread_queue_MP_callout mp_callout
|
||||
#endif
|
||||
/**
|
||||
* @brief Initializes a thread queue context.
|
||||
*
|
||||
* @param queue_context The thread queue context to initialize.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Thread_queue_Context_initialize(
|
||||
Thread_queue_Context *queue_context
|
||||
)
|
||||
{
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
queue_context->mp_callout = mp_callout;
|
||||
#if defined(RTEMS_MULTIPROCESSING) && defined(RTEMS_DEBUG)
|
||||
queue_context->mp_callout = NULL;
|
||||
#else
|
||||
(void) queue_context;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes a thread queue context.
|
||||
* @brief Sets the MP callout in the thread queue context.
|
||||
*
|
||||
* @param queue_context The thread queue context to initialize.
|
||||
* @param queue_context The thread queue context.
|
||||
* @param mp_callout Callout to unblock the thread in case it is actually a
|
||||
* thread proxy. This parameter is only used on multiprocessing
|
||||
* configurations. Used by thread queue extract and unblock methods for
|
||||
* objects with multiprocessing (MP) support.
|
||||
*/
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
#define _Thread_queue_Context_initialize( \
|
||||
queue_context, \
|
||||
mp_callout \
|
||||
) \
|
||||
_Thread_queue_Do_context_initialize( \
|
||||
queue_context, \
|
||||
mp_callout \
|
||||
)
|
||||
RTEMS_INLINE_ROUTINE void _Thread_queue_Context_set_MP_callout(
|
||||
Thread_queue_Context *queue_context,
|
||||
Thread_queue_MP_callout mp_callout
|
||||
)
|
||||
{
|
||||
queue_context->mp_callout = mp_callout;
|
||||
}
|
||||
#else
|
||||
#define _Thread_queue_Context_initialize( \
|
||||
queue_context, \
|
||||
mp_callout \
|
||||
) \
|
||||
_Thread_queue_Do_context_initialize( \
|
||||
queue_context \
|
||||
)
|
||||
#define _Thread_queue_Context_set_MP_callout( queue_context, mp_callout ) \
|
||||
do { \
|
||||
(void) queue_context; \
|
||||
} while ( 0 )
|
||||
#endif
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Thread_queue_Heads_initialize(
|
||||
|
||||
@@ -31,7 +31,7 @@ void _API_Mutex_Lock( API_Mutex_Control *the_mutex )
|
||||
previous_thread_life_state =
|
||||
_Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
|
||||
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
_ISR_lock_ISR_disable( &queue_context.Lock_context );
|
||||
|
||||
_CORE_mutex_Seize(
|
||||
|
||||
@@ -31,7 +31,7 @@ void _API_Mutex_Unlock( API_Mutex_Control *the_mutex )
|
||||
previous_thread_life_state = the_mutex->previous_thread_life_state;
|
||||
restore_thread_life_protection = the_mutex->Mutex.nest_count == 1;
|
||||
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
_ISR_lock_ISR_disable( &queue_context.Lock_context );
|
||||
_CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ static void _Condition_Wake( struct _Condition_Control *_condition, int count )
|
||||
Condition_Context context;
|
||||
|
||||
condition = _Condition_Get( _condition );
|
||||
_Thread_queue_Context_initialize( &context.Base, NULL );
|
||||
_Thread_queue_Context_initialize( &context.Base );
|
||||
_ISR_lock_ISR_disable( &context.Base.Lock_context );
|
||||
_Condition_Queue_acquire_critical( condition, &context.Base.Lock_context );
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ void _MPCI_Receive_server(
|
||||
Thread_queue_Context queue_context;
|
||||
|
||||
executing = _Thread_Get_executing();
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ void _Mutex_Release( struct _Mutex_Control *_mutex )
|
||||
Thread_Control *executing;
|
||||
|
||||
mutex = _Mutex_Get( _mutex );
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
executing = _Mutex_Queue_acquire( mutex, &queue_context.Lock_context );
|
||||
|
||||
_Assert( mutex->Queue.Queue.owner == executing );
|
||||
@@ -422,7 +422,7 @@ void _Mutex_recursive_Release( struct _Mutex_recursive_Control *_mutex )
|
||||
unsigned int nest_level;
|
||||
|
||||
mutex = _Mutex_recursive_Get( _mutex );
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
executing = _Mutex_Queue_acquire(
|
||||
&mutex->Mutex,
|
||||
&queue_context.Lock_context
|
||||
|
||||
@@ -114,7 +114,7 @@ void _Semaphore_Post( struct _Semaphore_Control *_sem )
|
||||
Thread_queue_Heads *heads;
|
||||
|
||||
sem = _Semaphore_Get( _sem );
|
||||
_Thread_queue_Context_initialize( &queue_context, NULL );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
_Semaphore_Queue_acquire( sem, &queue_context.Lock_context );
|
||||
|
||||
heads = sem->Queue.Queue.heads;
|
||||
|
||||
@@ -195,10 +195,7 @@ void _Thread_queue_Extract( Thread_Control *the_thread )
|
||||
void *lock;
|
||||
Thread_queue_Queue *queue;
|
||||
|
||||
_Thread_queue_Context_initialize(
|
||||
&queue_context,
|
||||
_Thread_queue_MP_callout_do_nothing
|
||||
);
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
lock = _Thread_Lock_acquire( the_thread, &queue_context.Lock_context );
|
||||
|
||||
queue = the_thread->Wait.queue;
|
||||
@@ -206,6 +203,10 @@ void _Thread_queue_Extract( Thread_Control *the_thread )
|
||||
if ( queue != NULL ) {
|
||||
_SMP_Assert( lock == &queue->Lock );
|
||||
|
||||
_Thread_queue_Context_set_MP_callout(
|
||||
&queue_context,
|
||||
_Thread_queue_MP_callout_do_nothing
|
||||
);
|
||||
_Thread_queue_Extract_critical(
|
||||
queue,
|
||||
the_thread->Wait.operations,
|
||||
@@ -229,7 +230,8 @@ Thread_Control *_Thread_queue_Do_dequeue(
|
||||
Thread_queue_Context queue_context;
|
||||
Thread_Control *the_thread;
|
||||
|
||||
_Thread_queue_Context_initialize( &queue_context, mp_callout );
|
||||
_Thread_queue_Context_initialize( &queue_context );
|
||||
_Thread_queue_Context_set_MP_callout( &queue_context, mp_callout );
|
||||
_Thread_queue_Acquire( the_thread_queue, &queue_context.Lock_context );
|
||||
|
||||
the_thread = _Thread_queue_First_locked( the_thread_queue, operations );
|
||||
|
||||
@@ -118,7 +118,7 @@ static void _Thread_Wake_up_joining_threads( Thread_Control *the_thread )
|
||||
join_context.exit_value = the_thread->Life.exit_value;
|
||||
#endif
|
||||
|
||||
_Thread_queue_Context_initialize( &join_context.Base, NULL );
|
||||
_Thread_queue_Context_initialize( &join_context.Base );
|
||||
_Thread_queue_Acquire(
|
||||
&the_thread->Join_queue,
|
||||
&join_context.Base.Lock_context
|
||||
|
||||
@@ -36,7 +36,7 @@ static Semaphore_Control *get_semaphore_control(rtems_id id)
|
||||
Thread_queue_Context queue_context;
|
||||
Semaphore_Control *sem;
|
||||
|
||||
sem = _Semaphore_Get(id, &queue_context, NULL);
|
||||
sem = _Semaphore_Get(id, &queue_context);
|
||||
rtems_test_assert(sem != NULL);
|
||||
_ISR_lock_ISR_enable(&queue_context.Lock_context);
|
||||
|
||||
|
||||
@@ -514,7 +514,7 @@ void complete_test( void )
|
||||
|
||||
benchmark_timer_initialize();
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
|
||||
(void) _Semaphore_Get( Semaphore_id, &queue_context, NULL );
|
||||
(void) _Semaphore_Get( Semaphore_id, &queue_context );
|
||||
_ISR_lock_ISR_enable( &queue_context.Lock_context );
|
||||
}
|
||||
semaphore_get_time = benchmark_timer_read();
|
||||
|
||||
Reference in New Issue
Block a user