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/msgqdelete.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/msgqdelete.c')
-rw-r--r-- | cpukit/rtems/src/msgqdelete.c | 85 |
1 files changed, 38 insertions, 47 deletions
diff --git a/cpukit/rtems/src/msgqdelete.c b/cpukit/rtems/src/msgqdelete.c index 506c069704..810b74172b 100644 --- a/cpukit/rtems/src/msgqdelete.c +++ b/cpukit/rtems/src/msgqdelete.c @@ -25,64 +25,55 @@ rtems_status_code rtems_message_queue_delete( rtems_id id ) { - Message_queue_Control *the_message_queue; - Objects_Locations location; - ISR_lock_Context lock_context; + Message_queue_Control *the_message_queue; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); - the_message_queue = _Message_queue_Get_interrupt_disable( - id, - &location, - &lock_context - ); - switch ( location ) { + the_message_queue = _Message_queue_Get_interrupt_disable( id, &lock_context ); - case OBJECTS_LOCAL: - _CORE_message_queue_Acquire_critical( - &the_message_queue->message_queue, - &lock_context - ); + if ( the_message_queue == NULL ) { + _Objects_Allocator_unlock(); - _Objects_Close( &_Message_queue_Information, - &the_message_queue->Object ); +#if defined(RTEMS_MULTIPROCESSING) + if ( _Message_queue_MP_Is_remote( id ) ) { + return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; + } +#endif - _CORE_message_queue_Close( - &the_message_queue->message_queue, - _Message_queue_MP_Send_object_was_deleted, - id, - &lock_context - ); + return RTEMS_INVALID_ID; + } -#if defined(RTEMS_MULTIPROCESSING) - if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) { - _Objects_MP_Close( - &_Message_queue_Information, - the_message_queue->Object.id - ); + _CORE_message_queue_Acquire_critical( + &the_message_queue->message_queue, + &lock_context + ); - _Message_queue_MP_Send_process_packet( - MESSAGE_QUEUE_MP_ANNOUNCE_DELETE, - the_message_queue->Object.id, - 0, /* Not used */ - 0 - ); - } -#endif - _Message_queue_Free( the_message_queue ); - _Objects_Allocator_unlock(); - return RTEMS_SUCCESSFUL; + _Objects_Close( &_Message_queue_Information, &the_message_queue->Object ); + + _CORE_message_queue_Close( + &the_message_queue->message_queue, + _Message_queue_MP_Send_object_was_deleted, + id, + &lock_context + ); #if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: - _Objects_Allocator_unlock(); - return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; -#endif + if ( _Attributes_Is_global( the_message_queue->attribute_set ) ) { + _Objects_MP_Close( + &_Message_queue_Information, + the_message_queue->Object.id + ); - case OBJECTS_ERROR: - break; + _Message_queue_MP_Send_process_packet( + MESSAGE_QUEUE_MP_ANNOUNCE_DELETE, + the_message_queue->Object.id, + 0, /* Not used */ + 0 + ); } +#endif + _Message_queue_Free( the_message_queue ); _Objects_Allocator_unlock(); - - return RTEMS_INVALID_ID; + return RTEMS_SUCCESSFUL; } |