diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-20 06:43:11 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-22 09:25:08 +0200 |
commit | 2dd5e6fb320a5309e02570fad93d4b5fc09328a7 (patch) | |
tree | 0600823693f0c6d2e521537622d2ac89809765a0 /cpukit/posix/src/sempost.c | |
parent | score: Avoid Giant lock for CORE mtx/sem (diff) | |
download | rtems-2dd5e6fb320a5309e02570fad93d4b5fc09328a7.tar.bz2 |
posix: Use _Objects_Get_local() for semaphores
This simplifies the code since the object location is no longer used.
Remove superfluous header includes.
Diffstat (limited to 'cpukit/posix/src/sempost.c')
-rw-r--r-- | cpukit/posix/src/sempost.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/cpukit/posix/src/sempost.c b/cpukit/posix/src/sempost.c index 8e8cce9251..13c0132abd 100644 --- a/cpukit/posix/src/sempost.c +++ b/cpukit/posix/src/sempost.c @@ -18,48 +18,28 @@ #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_post( sem_t *sem ) { - POSIX_Semaphore_Control *the_semaphore; - Objects_Locations location; - ISR_lock_Context lock_context; - - the_semaphore = _POSIX_Semaphore_Get_interrupt_disable( - sem, - &location, - &lock_context - ); - switch ( location ) { + POSIX_Semaphore_Control *the_semaphore; + ISR_lock_Context lock_context; - case OBJECTS_LOCAL: - _CORE_semaphore_Surrender( - &the_semaphore->Semaphore, - NULL, - 0, - &lock_context - ); - return 0; + the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context ); -#if defined(RTEMS_MULTIPROCESSING) - case OBJECTS_REMOTE: -#endif - case OBJECTS_ERROR: - break; + if ( the_semaphore == NULL ) { + rtems_set_errno_and_return_minus_one( EINVAL ); } - rtems_set_errno_and_return_minus_one( EINVAL ); + _CORE_semaphore_Surrender( + &the_semaphore->Semaphore, + NULL, + 0, + &lock_context + ); + return 0; } |