From 4025a60fcb892169266102a58beef4caad17340c Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 19 Apr 2016 17:02:54 +0200 Subject: score: Avoid Giant lock for CORE mtx/sem Avoid Giant lock for CORE mutex and semaphore flush and delete operations. Update #2555. --- cpukit/posix/src/semunlink.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cpukit/posix/src/semunlink.c') diff --git a/cpukit/posix/src/semunlink.c b/cpukit/posix/src/semunlink.c index b8406185d4..665aa7337c 100644 --- a/cpukit/posix/src/semunlink.c +++ b/cpukit/posix/src/semunlink.c @@ -21,7 +21,6 @@ #include #include -#include int sem_unlink( const char *name @@ -29,6 +28,7 @@ int sem_unlink( { POSIX_Semaphore_Control *the_semaphore; Objects_Get_by_name_error error; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); @@ -38,9 +38,12 @@ int sem_unlink( rtems_set_errno_and_return_minus_one( _POSIX_Get_by_name_error( error ) ); } - the_semaphore->linked = false; _POSIX_Semaphore_Namespace_remove( the_semaphore ); - _POSIX_Semaphore_Delete( the_semaphore ); + + _ISR_lock_ISR_disable( &lock_context ); + _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &lock_context ); + the_semaphore->linked = false; + _POSIX_Semaphore_Delete( the_semaphore, &lock_context ); _Objects_Allocator_unlock(); return 0; -- cgit v1.2.3