forked from Imagelibrary/rtems
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:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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?
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user