summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mutexlocksupp.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/mutexlocksupp.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/mutexlocksupp.c')
-rw-r--r--cpukit/posix/src/mutexlocksupp.c67
1 files changed, 20 insertions, 47 deletions
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index 9e78c9ea45..3c4e26e04a 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -18,62 +18,35 @@
#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/score/threadimpl.h>
#include <rtems/posix/muteximpl.h>
-#include <rtems/posix/priorityimpl.h>
THREAD_WAIT_QUEUE_OBJECT_ASSERT( POSIX_Mutex_Control, Mutex.Wait_queue );
-/*
- * _POSIX_Mutex_Lock_support
- *
- * A support routine which implements guts of the blocking, non-blocking, and
- * timed wait version of mutex lock.
- */
-
int _POSIX_Mutex_Lock_support(
- pthread_mutex_t *mutex,
- bool blocking,
- Watchdog_Interval timeout
+ pthread_mutex_t *mutex,
+ bool blocking,
+ Watchdog_Interval timeout
)
{
- POSIX_Mutex_Control *the_mutex;
- Objects_Locations location;
- ISR_lock_Context lock_context;
- Thread_Control *executing;
-
- the_mutex = _POSIX_Mutex_Get_interrupt_disable(
- mutex,
- &location,
- &lock_context
- );
- switch ( location ) {
+ POSIX_Mutex_Control *the_mutex;
+ ISR_lock_Context lock_context;
+ Thread_Control *executing;
- case OBJECTS_LOCAL:
- executing = _Thread_Executing;
- _CORE_mutex_Seize(
- &the_mutex->Mutex,
- executing,
- blocking,
- timeout,
- &lock_context
- );
- return _POSIX_Mutex_Translate_core_mutex_return_code(
- (CORE_mutex_Status) executing->Wait.return_code
- );
+ 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;
+ executing = _Thread_Executing;
+ _CORE_mutex_Seize(
+ &the_mutex->Mutex,
+ executing,
+ blocking,
+ timeout,
+ &lock_context
+ );
+ return _POSIX_Mutex_Translate_core_mutex_return_code(
+ (CORE_mutex_Status) executing->Wait.return_code
+ );
}