summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/inline/rtems/posix/cond.inl
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/inline/rtems/posix/cond.inl')
-rw-r--r--cpukit/posix/inline/rtems/posix/cond.inl39
1 files changed, 30 insertions, 9 deletions
diff --git a/cpukit/posix/inline/rtems/posix/cond.inl b/cpukit/posix/inline/rtems/posix/cond.inl
index 19d5c6ec4b..4d5f8612de 100644
--- a/cpukit/posix/inline/rtems/posix/cond.inl
+++ b/cpukit/posix/inline/rtems/posix/cond.inl
@@ -3,7 +3,7 @@
* This include file contains the static inline implementation of the private
* inlined routines for POSIX condition variables.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2002.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -16,6 +16,8 @@
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_inl
#define __RTEMS_POSIX_CONDITION_VARIABLES_inl
+#include <pthread.h>
+
/*PAGE
*
* _POSIX_Condition_variables_Allocate
@@ -47,19 +49,38 @@ RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
*
* _POSIX_Condition_variables_Get
*/
-
-RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
+
+RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control
+*_POSIX_Condition_variables_Get (
Objects_Id *id,
Objects_Locations *location
)
{
-/* XXX should support COND_INITIALIZER */
- if ( id )
- return (POSIX_Condition_variables_Control *)
- _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
+ int status;
+
+ if ( !id ) {
+ *location = OBJECTS_ERROR;
+ return (POSIX_Condition_variables_Control *) 0;
+ }
+
+ if ( *id == PTHREAD_COND_INITIALIZER ) {
+ /*
+ * Do an "auto-create" here.
+ */
+
+ status = pthread_cond_init( id, 0 );
+ if ( status ) {
+ *location = OBJECTS_ERROR;
+ return (POSIX_Condition_variables_Control *) 0;
+ }
+ }
+
+ /*
+ * Now call Objects_Get()
+ */
- *location = OBJECTS_ERROR;
- return NULL;
+ return (POSIX_Condition_variables_Control *)
+ _Objects_Get( &_POSIX_Condition_variables_Information, *id, location );
}
/*PAGE