diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 07:01:03 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 16:16:26 +0200 |
commit | 05f9b02e3c0927e69f96bafaac359a53c7f92322 (patch) | |
tree | cd888a5621379b636bf18b5aab6647ca7e18908a /cpukit/posix/src/condget.c | |
parent | score: Use _RBTree_Insert_inline() (diff) | |
download | rtems-05f9b02e3c0927e69f96bafaac359a53c7f92322.tar.bz2 |
posix: Add and use _POSIX_Get_object_body()
Diffstat (limited to 'cpukit/posix/src/condget.c')
-rw-r--r-- | cpukit/posix/src/condget.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/cpukit/posix/src/condget.c b/cpukit/posix/src/condget.c index b89566af03..5676de861a 100644 --- a/cpukit/posix/src/condget.c +++ b/cpukit/posix/src/condget.c @@ -12,48 +12,19 @@ #endif #include <rtems/posix/condimpl.h> - -static bool _POSIX_Condition_variables_Check_id_and_auto_init( - pthread_cond_t *cond -) -{ - if ( cond == NULL ) { - return false; - } - - if ( *cond == PTHREAD_COND_INITIALIZER ) { - int eno; - - _Once_Lock(); - - if ( *cond == PTHREAD_COND_INITIALIZER ) { - eno = pthread_cond_init( cond, NULL ); - } else { - eno = 0; - } - - _Once_Unlock(); - - if ( eno != 0 ) { - return false; - } - } - - return true; -} +#include <rtems/posix/posixapi.h> POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get( pthread_cond_t *cond, ISR_lock_Context *lock_context ) { - if ( !_POSIX_Condition_variables_Check_id_and_auto_init( cond ) ) { - return NULL; - } - - return (POSIX_Condition_variables_Control *) _Objects_Get_local( - (Objects_Id) *cond, + _POSIX_Get_object_body( + POSIX_Condition_variables_Control, + cond, lock_context, - &_POSIX_Condition_variables_Information + &_POSIX_Condition_variables_Information, + PTHREAD_COND_INITIALIZER, + pthread_cond_init ); } |