diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-09-26 07:49:17 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-05 14:29:02 +0200 |
commit | 5222488573e3ba8c2eceffe29f878a73a3a81694 (patch) | |
tree | 4b4ca72268b8f40da493ca252780c197bd23a5ef /cpukit/posix/src/condwait.c | |
parent | posix: Implement self-contained POSIX rwlocks (diff) | |
download | rtems-5222488573e3ba8c2eceffe29f878a73a3a81694.tar.bz2 |
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.
Diffstat (limited to 'cpukit/posix/src/condwait.c')
-rw-r--r-- | cpukit/posix/src/condwait.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 <rtems/posix/condimpl.h> +#include <string.h> + +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 */ |