diff options
Diffstat (limited to 'cpukit/rtems/src/semdelete.c')
-rw-r--r-- | cpukit/rtems/src/semdelete.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c index ea82b7757d..6e7c5eafad 100644 --- a/cpukit/rtems/src/semdelete.c +++ b/cpukit/rtems/src/semdelete.c @@ -44,6 +44,8 @@ rtems_status_code rtems_semaphore_delete( Semaphore_Control *the_semaphore; Objects_Locations location; + _Objects_Allocator_lock(); + the_semaphore = _Semaphore_Get( id, &location ); switch ( location ) { @@ -53,6 +55,7 @@ rtems_status_code rtems_semaphore_delete( !_Attributes_Is_simple_binary_semaphore( the_semaphore->attribute_set ) ) { _Objects_Put( &the_semaphore->Object ); + _Objects_Allocator_unlock(); return RTEMS_RESOURCE_IN_USE; } _CORE_mutex_Flush( @@ -70,8 +73,6 @@ rtems_status_code rtems_semaphore_delete( _Objects_Close( &_Semaphore_Information, &the_semaphore->Object ); - _Semaphore_Free( the_semaphore ); - #if defined(RTEMS_MULTIPROCESSING) if ( _Attributes_Is_global( the_semaphore->attribute_set ) ) { @@ -85,12 +86,15 @@ rtems_status_code rtems_semaphore_delete( ); } #endif + _Objects_Put( &the_semaphore->Object ); + _Semaphore_Free( the_semaphore ); + _Objects_Allocator_unlock(); return RTEMS_SUCCESSFUL; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: - _Thread_Dispatch(); + _Objects_Allocator_unlock(); return RTEMS_ILLEGAL_ON_REMOTE_OBJECT; #endif @@ -98,5 +102,6 @@ rtems_status_code rtems_semaphore_delete( break; } + _Objects_Allocator_unlock(); return RTEMS_INVALID_ID; } |