score: _CORE_message_queue_Submit()

Move lock acquire to caller of _CORE_message_queue_Submit() to allow
state checks during send operations under lock protection.
This commit is contained in:
Sebastian Huber
2016-04-27 16:21:07 +02:00
parent b0eba5ed8a
commit 99112f76b8
4 changed files with 14 additions and 3 deletions

View File

@@ -96,6 +96,11 @@ int _POSIX_Message_queue_Send_support(
else
do_wait = wait;
_CORE_message_queue_Acquire_critical(
&the_mq->Message_queue,
&lock_context
);
/*
* Now perform the actual message receive
*/

View File

@@ -52,6 +52,10 @@ rtems_status_code rtems_message_queue_send(
switch ( location ) {
case OBJECTS_LOCAL:
_CORE_message_queue_Acquire_critical(
&the_message_queue->message_queue,
&lock_context
);
status = _CORE_message_queue_Send(
&the_message_queue->message_queue,
buffer,

View File

@@ -52,6 +52,10 @@ rtems_status_code rtems_message_queue_urgent(
switch ( location ) {
case OBJECTS_LOCAL:
_CORE_message_queue_Acquire_critical(
&the_message_queue->message_queue,
&lock_context
);
status = _CORE_message_queue_Urgent(
&the_message_queue->message_queue,
buffer,

View File

@@ -44,12 +44,10 @@ CORE_message_queue_Status _CORE_message_queue_Do_submit(
Thread_Control *the_thread;
if ( size > the_message_queue->maximum_message_size ) {
_ISR_lock_ISR_enable( lock_context );
_CORE_message_queue_Release( the_message_queue, lock_context );
return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
}
_CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
/*
* Is there a thread currently waiting on this message queue?
*/