From 05f9b02e3c0927e69f96bafaac359a53c7f92322 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 May 2016 07:01:03 +0200 Subject: posix: Add and use _POSIX_Get_object_body() --- cpukit/posix/src/condget.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'cpukit/posix/src/condget.c') 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 - -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 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 ); } -- cgit v1.2.3