summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mutexunlock.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-18 17:21:43 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-21 07:29:39 +0200
commitb8bdced14d82d07965a6fa45bb80687420bdbd8a (patch)
tree751836b60c1e49e7d6befe2ace73085b3d1d373e /cpukit/posix/src/mutexunlock.c
parentposix: _POSIX_Condition_variables_Wait_support() (diff)
downloadrtems-b8bdced14d82d07965a6fa45bb80687420bdbd8a.tar.bz2
posix: Simplify _POSIX_Mutex_Get_interrupt_disable
Remove superfluous location parameter.
Diffstat (limited to 'cpukit/posix/src/mutexunlock.c')
-rw-r--r--cpukit/posix/src/mutexunlock.c45
1 files changed, 13 insertions, 32 deletions
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index 1a83a0a241..4de1917648 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -18,14 +18,7 @@
#include "config.h"
#endif
-#include <errno.h>
-#include <pthread.h>
-
-#include <rtems/system.h>
-#include <rtems/score/coremuteximpl.h>
-#include <rtems/score/watchdog.h>
#include <rtems/posix/muteximpl.h>
-#include <rtems/posix/priorityimpl.h>
/*
* 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
@@ -37,33 +30,21 @@ int pthread_mutex_unlock(
pthread_mutex_t *mutex
)
{
- register POSIX_Mutex_Control *the_mutex;
- Objects_Locations location;
- CORE_mutex_Status status;
- ISR_lock_Context lock_context;
-
- the_mutex = _POSIX_Mutex_Get_interrupt_disable(
- mutex,
- &location,
- &lock_context
- );
- switch ( location ) {
+ POSIX_Mutex_Control *the_mutex;
+ CORE_mutex_Status status;
+ ISR_lock_Context lock_context;
- case OBJECTS_LOCAL:
- status = _CORE_mutex_Surrender(
- &the_mutex->Mutex,
- NULL,
- 0,
- &lock_context
- );
- return _POSIX_Mutex_Translate_core_mutex_return_code( status );
+ the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &lock_context );
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE:
-#endif
- case OBJECTS_ERROR:
- break;
+ if ( the_mutex == NULL ) {
+ return EINVAL;
}
- return EINVAL;
+ status = _CORE_mutex_Surrender(
+ &the_mutex->Mutex,
+ NULL,
+ 0,
+ &lock_context
+ );
+ return _POSIX_Mutex_Translate_core_mutex_return_code( status );
}