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/semclose.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'cpukit/posix/src/semclose.c') diff --git a/cpukit/posix/src/semclose.c b/cpukit/posix/src/semclose.c index f134dc43a7..1468c7fb35 100644 --- a/cpukit/posix/src/semclose.c +++ b/cpukit/posix/src/semclose.c @@ -18,17 +18,9 @@ #include "config.h" #endif -#include - -#include -#include -#include #include -#include -#include #include -#include int sem_close( sem_t *sem @@ -36,15 +28,23 @@ int sem_close( { POSIX_Semaphore_Control *the_semaphore; Objects_Locations location; + ISR_lock_Context lock_context; _Objects_Allocator_lock(); - the_semaphore = _POSIX_Semaphore_Get( sem, &location ); + the_semaphore = _POSIX_Semaphore_Get_interrupt_disable( + sem, + &location, + &lock_context + ); switch ( location ) { case OBJECTS_LOCAL: + _CORE_semaphore_Acquire_critical( + &the_semaphore->Semaphore, + &lock_context + ); the_semaphore->open_count -= 1; - _POSIX_Semaphore_Delete( the_semaphore ); - _Objects_Put( &the_semaphore->Object ); + _POSIX_Semaphore_Delete( the_semaphore, &lock_context ); _Objects_Allocator_unlock(); return 0; -- cgit v1.2.3