Index: cygwin/thread.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/thread.cc,v
retrieving revision 1.49
diff -u -p -2 -r1.49 thread.cc
--- thread.cc	2001/09/12 17:46:36	1.49
+++ thread.cc	2001/09/24 15:26:08
@@ -1636,9 +1636,29 @@ __pthread_getspecific (pthread_key_t key
 
 int
-__pthread_cond_destroy (pthread_cond_t *cond)
+__pthread_cond_construct (pthread_cond_t *cond)
 {
+  int res = check_null_invalid_struct (cond);
+  if (res)
+    return res;
+
+  if (*cond == PTHREAD_COND_INITIALIZER)
+    {
+      if ((res = __pthread_cond_init (cond, NULL)) != 0)
+	return res;
+    }
+
   if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
     return EINVAL;
 
+  return 0;
+}
+
+int
+__pthread_cond_destroy (pthread_cond_t *cond)
+{
+  int err = __pthread_cond_construct (cond);
+  if (err)
+    return err;
+
   /*reads are atomic */
   if ((*cond)->waiting)
@@ -1657,5 +1677,6 @@ __pthread_cond_init (pthread_cond_t *con
     return EINVAL;
 
-  if (verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
+  if (*cond != PTHREAD_COND_INITIALIZER &&
+      verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
     return EBUSY;
 
@@ -1675,6 +1696,7 @@ int
 __pthread_cond_broadcast (pthread_cond_t *cond)
 {
-  if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
-    return EINVAL;
+  int err = __pthread_cond_construct (cond);
+  if (err)
+    return err;
 
   (*cond)->BroadCast ();
@@ -1686,6 +1708,7 @@ int
 __pthread_cond_signal (pthread_cond_t *cond)
 {
-  if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
-    return EINVAL;
+  int err = __pthread_cond_construct (cond);
+  if (err)
+    return err;
 
   (*cond)->Signal ();
@@ -1709,7 +1732,8 @@ __pthread_cond_timedwait (pthread_cond_t
 
   if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
-    return EINVAL;
-  if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
     return EINVAL;
+  int err = __pthread_cond_construct (cond);
+  if (err)
+    return err;
   struct timeb currSysTime;
   long waitlength;
@@ -1759,7 +1783,8 @@ __pthread_cond_wait (pthread_cond_t *con
   themutex = mutex;
   if (!verifyable_object_isvalid (*themutex, PTHREAD_MUTEX_MAGIC))
-    return EINVAL;
-  if (!verifyable_object_isvalid (*cond, PTHREAD_COND_MAGIC))
     return EINVAL;
+  int err = __pthread_cond_construct (cond);
+  if (err)
+    return err;
 
   if (pthread_mutex_lock (&(*cond)->cond_access))
Index: cygwin/winsup.h
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/winsup.h,v
retrieving revision 1.69
diff -u -p -2 -r1.69 winsup.h
--- winsup.h	2001/09/12 17:46:37	1.69
+++ winsup.h	2001/09/24 15:26:08
@@ -195,5 +195,5 @@ int __stdcall __check_null_invalid_struc
 
 #define check_null_invalid_struct(s) \
-  __check_null_invalid ((s), sizeof (*(s)))
+  __check_null_invalid_struct ((s), sizeof (*(s)))
 #define check_null_invalid_struct_errno(s) \
   __check_null_invalid_struct_errno ((s), sizeof (*(s)))
Index: cygwin/include/pthread.h
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/include/pthread.h,v
retrieving revision 1.7
diff -u -p -2 -r1.7 pthread.h
--- pthread.h	2001/05/09 14:45:47	1.7
+++ pthread.h	2001/09/24 15:26:08
@@ -29,5 +29,5 @@ extern "C"
 /* FIXME: this should allocate a new cond variable, and return the value  that
  would normally be written to the passed parameter of pthread_cond_init(lvalue, NULL); */
-/* #define PTHREAD_COND_INITIALIZER 0 */
+#define PTHREAD_COND_INITIALIZER 0
 
 #define PTHREAD_DESTRUCTOR_ITERATIONS 1
@@ -44,5 +44,5 @@ extern "C"
 #define PTHREAD_CANCEL_DISABLE 1
 #define PTHREAD_CANCELED
-#define PTHREAD_COND_INITIALIZER
+// #define PTHREAD_COND_INITIALIZER 
 #define PTHREAD_CREATE_DETACHED 1
 /* the default : joinable */
@@ -102,5 +102,5 @@ void pthread_cleanup_push (void (*routin
 void pthread_cleanup_pop (int execute);
 */
-typedef void __cleanup_routine_type (void *);
+typedef void (*__cleanup_routine_type) (void *);
 
 #define pthread_cleanup_push(fn, arg) { __cleanup_routine_type __cleanup_routine=fn; \
