summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mutexget.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 07:01:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-20 16:16:26 +0200
commit05f9b02e3c0927e69f96bafaac359a53c7f92322 (patch)
treecd888a5621379b636bf18b5aab6647ca7e18908a /cpukit/posix/src/mutexget.c
parentscore: Use _RBTree_Insert_inline() (diff)
downloadrtems-05f9b02e3c0927e69f96bafaac359a53c7f92322.tar.bz2
posix: Add and use _POSIX_Get_object_body()
Diffstat (limited to 'cpukit/posix/src/mutexget.c')
-rw-r--r--cpukit/posix/src/mutexget.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/cpukit/posix/src/mutexget.c b/cpukit/posix/src/mutexget.c
index 9d34ecb583..97d6dff658 100644
--- a/cpukit/posix/src/mutexget.c
+++ b/cpukit/posix/src/mutexget.c
@@ -19,50 +19,19 @@
#endif
#include <rtems/posix/muteximpl.h>
-#include <rtems/score/apimutex.h>
-
-static bool _POSIX_Mutex_Check_id_and_auto_init( pthread_mutex_t *mutex )
-{
- if ( mutex == NULL ) {
- return false;
- }
-
- if ( *mutex == PTHREAD_MUTEX_INITIALIZER ) {
- int eno;
-
- _Once_Lock();
-
- if ( *mutex == PTHREAD_MUTEX_INITIALIZER ) {
- eno = pthread_mutex_init( mutex, NULL );
- } else {
- eno = 0;
- }
-
- _Once_Unlock();
-
- if ( eno != 0 ) {
- return false;
- }
- }
-
- return true;
-}
+#include <rtems/posix/posixapi.h>
POSIX_Mutex_Control *_POSIX_Mutex_Get_interrupt_disable(
pthread_mutex_t *mutex,
ISR_lock_Context *lock_context
)
{
- Objects_Locations location;
-
- if ( !_POSIX_Mutex_Check_id_and_auto_init( mutex ) ) {
- return NULL;
- }
-
- return (POSIX_Mutex_Control *) _Objects_Get_isr_disable(
+ _POSIX_Get_object_body(
+ POSIX_Mutex_Control,
+ mutex,
+ lock_context,
&_POSIX_Mutex_Information,
- (Objects_Id) *mutex,
- &location,
- lock_context
+ PTHREAD_MUTEX_INITIALIZER,
+ pthread_mutex_init
);
}