From 5222488573e3ba8c2eceffe29f878a73a3a81694 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 26 Sep 2017 07:49:17 +0200 Subject: posix: Implement self-contained POSIX condvar POSIX condition variables are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3113. --- cpukit/posix/src/condwait.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'cpukit/posix/src/condwait.c') diff --git a/cpukit/posix/src/condwait.c b/cpukit/posix/src/condwait.c index 9a88287d0d..9527077757 100644 --- a/cpukit/posix/src/condwait.c +++ b/cpukit/posix/src/condwait.c @@ -20,6 +20,27 @@ #include +#include + +bool _POSIX_Condition_variables_Auto_initialization( + POSIX_Condition_variables_Control *the_cond +) +{ + POSIX_Condition_variables_Control zero; + unsigned long flags; + + memset( &zero, 0, sizeof( zero ) ); + + if ( memcmp( the_cond, &zero, sizeof( *the_cond ) ) != 0 ) { + return false; + } + + flags = (uintptr_t) the_cond ^ POSIX_CONDITION_VARIABLES_MAGIC; + flags &= ~POSIX_CONDITION_VARIABLES_FLAGS_MASK; + the_cond->flags = flags; + return true; +} + /* * 11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105 */ -- cgit v1.2.3