diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-19 17:02:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-22 09:25:08 +0200 |
commit | 4025a60fcb892169266102a58beef4caad17340c (patch) | |
tree | 004df492a31db98faa24335a663eed429ebb5d05 /cpukit/posix/src/semclose.c | |
parent | posix: Avoid Giant lock in sem_getvalue() (diff) | |
download | rtems-4025a60fcb892169266102a58beef4caad17340c.tar.bz2 |
score: Avoid Giant lock for CORE mtx/sem
Avoid Giant lock for CORE mutex and semaphore flush and delete
operations.
Update #2555.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/semclose.c | 22 |
1 files changed, 11 insertions, 11 deletions
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 <stdarg.h> - -#include <errno.h> -#include <fcntl.h> -#include <pthread.h> #include <semaphore.h> -#include <limits.h> -#include <rtems/system.h> #include <rtems/posix/semaphoreimpl.h> -#include <rtems/seterr.h> 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; |