diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 14:21:12 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:16:59 +0200 |
commit | 641b44c225c71af51285f9a1b408a4f4c2844f8b (patch) | |
tree | 0141b2e6d009fc681b3599796874734457ced6dd /cpukit/rtems/src/msgqgetnumberpending.c | |
parent | rtems: Remove location from _Partition_Get() (diff) | |
download | rtems-641b44c225c71af51285f9a1b408a4f4c2844f8b.tar.bz2 |
rtems: _Message_queue_Get_interrupt_disable()
Use _Objects_Get_local() for _Message_queue_Get_interrupt_disable() to
get rid of the location parameter. Move remote object handling to
message queue MPCI support.
Diffstat (limited to 'cpukit/rtems/src/msgqgetnumberpending.c')
-rw-r--r-- | cpukit/rtems/src/msgqgetnumberpending.c | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/cpukit/rtems/src/msgqgetnumberpending.c b/cpukit/rtems/src/msgqgetnumberpending.c index 756e8fe9c9..6fa0e4f62e 100644 --- a/cpukit/rtems/src/msgqgetnumberpending.c +++ b/cpukit/rtems/src/msgqgetnumberpending.c @@ -26,48 +26,33 @@ rtems_status_code rtems_message_queue_get_number_pending( ) { Message_queue_Control *the_message_queue; - Objects_Locations location; ISR_lock_Context lock_context; - if ( !count ) + if ( count == NULL ) { return RTEMS_INVALID_ADDRESS; + } the_message_queue = _Message_queue_Get_interrupt_disable( id, - &location, &lock_context ); - switch ( location ) { - - case OBJECTS_LOCAL: - _CORE_message_queue_Acquire_critical( - &the_message_queue->message_queue, - &lock_context - ); - *count = the_message_queue->message_queue.number_of_pending_messages; - _CORE_message_queue_Release( - &the_message_queue->message_queue, - &lock_context - ); - return RTEMS_SUCCESSFUL; + if ( the_message_queue == NULL ) { #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - _Thread_Get_executing()->Wait.return_argument = count; - - return _Message_queue_MP_Send_request_packet( - MESSAGE_QUEUE_MP_GET_NUMBER_PENDING_REQUEST, - id, - 0, /* buffer not used */ - 0, /* size */ - 0, /* option_set not used */ - MPCI_DEFAULT_TIMEOUT - ); + _Message_queue_MP_Get_number_pending( id, count ); +#else + return RTEMS_INVALID_ID; #endif - - case OBJECTS_ERROR: - break; } - return RTEMS_INVALID_ID; + _CORE_message_queue_Acquire_critical( + &the_message_queue->message_queue, + &lock_context + ); + *count = the_message_queue->message_queue.number_of_pending_messages; + _CORE_message_queue_Release( + &the_message_queue->message_queue, + &lock_context + ); + return RTEMS_SUCCESSFUL; } |