mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-10 16:51:38 +08:00
score: _CORE_message_queue_Seize()
Move lock acquire to caller of _CORE_message_queue_Seize() to allow state checks during receive operations under lock protection.
This commit is contained in:
@@ -96,6 +96,11 @@ ssize_t _POSIX_Message_queue_Receive_support(
|
||||
else
|
||||
do_wait = wait;
|
||||
|
||||
_CORE_message_queue_Acquire_critical(
|
||||
&the_mq->Message_queue,
|
||||
&lock_context
|
||||
);
|
||||
|
||||
/*
|
||||
* Now perform the actual message receive
|
||||
*/
|
||||
|
||||
@@ -68,6 +68,11 @@ rtems_status_code rtems_message_queue_receive(
|
||||
else
|
||||
wait = true;
|
||||
|
||||
_CORE_message_queue_Acquire_critical(
|
||||
&the_message_queue->message_queue,
|
||||
&lock_context
|
||||
);
|
||||
|
||||
executing = _Thread_Executing;
|
||||
_CORE_message_queue_Seize(
|
||||
&the_message_queue->message_queue,
|
||||
|
||||
@@ -40,7 +40,6 @@ void _CORE_message_queue_Seize(
|
||||
CORE_message_queue_Buffer_control *the_message;
|
||||
|
||||
executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL;
|
||||
_CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
|
||||
the_message = _CORE_message_queue_Get_pending_message( the_message_queue );
|
||||
if ( the_message != NULL ) {
|
||||
the_message_queue->number_of_pending_messages -= 1;
|
||||
|
||||
Reference in New Issue
Block a user