diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-30 13:12:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-05-19 12:00:46 +0200 |
commit | cc18d7bec7b3c5515cb9e6cd9771d4b94309b3bd (patch) | |
tree | 59fd8c8ca70830762e632e255a2078f22ac6a821 /cpukit/rtems/src/msgqreceive.c | |
parent | score: Delete _CORE_message_queue_Flush_support() (diff) | |
download | rtems-cc18d7bec7b3c5515cb9e6cd9771d4b94309b3bd.tar.bz2 |
score: Fine grained locking for message queues
Aggregate several critical sections into a bigger one. Sending and
receiving messages is now protected by an ISR lock. Thread dispatching
is only disabled in case a blocking operation is necessary. The message
copy procedure is done inside the critical section (interrupts
disabled). Thus this change may have a negative impact on the interrupt
latency in case very large messages are transferred.
Update #2273.
Diffstat (limited to 'cpukit/rtems/src/msgqreceive.c')
-rw-r--r-- | cpukit/rtems/src/msgqreceive.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpukit/rtems/src/msgqreceive.c b/cpukit/rtems/src/msgqreceive.c index db09cfe547..2b9a4e742b 100644 --- a/cpukit/rtems/src/msgqreceive.c +++ b/cpukit/rtems/src/msgqreceive.c @@ -42,6 +42,7 @@ rtems_status_code rtems_message_queue_receive( Objects_Locations location; bool wait; Thread_Control *executing; + ISR_lock_Context lock_context; if ( !buffer ) return RTEMS_INVALID_ADDRESS; @@ -49,7 +50,11 @@ rtems_status_code rtems_message_queue_receive( if ( !size ) return RTEMS_INVALID_ADDRESS; - the_message_queue = _Message_queue_Get( id, &location ); + the_message_queue = _Message_queue_Get_interrupt_disable( + id, + &location, + &lock_context + ); switch ( location ) { case OBJECTS_LOCAL: @@ -66,9 +71,9 @@ rtems_status_code rtems_message_queue_receive( buffer, size, wait, - timeout + timeout, + &lock_context ); - _Objects_Put( &the_message_queue->Object ); return _Message_queue_Translate_core_message_queue_return_code( executing->Wait.return_code ); |