summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_cond.c
diff options
context:
space:
mode:
authorJohn Birrell <jb@FreeBSD.org>1998-04-04 11:33:01 +0000
committerJohn Birrell <jb@FreeBSD.org>1998-04-04 11:33:01 +0000
commit883674371ecbe1ce8376f70836be251397ae5327 (patch)
tree1b8ef2058be111839002ca671ab1552c6319d3fb /lib/libpthread/thread/thr_cond.c
parent5a2f1fed77fef948b36091c15bfcdda586756bc8 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_cond.c')
-rw-r--r--lib/libpthread/thread/thr_cond.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c
index 978ad045db68..e7fcc62e155c 100644
--- a/lib/libpthread/thread/thr_cond.c
+++ b/lib/libpthread/thread/thr_cond.c
@@ -134,9 +134,15 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex)
int rval = 0;
int status;
- if (cond == NULL || *cond == NULL) {
+ if (cond == NULL)
rval = EINVAL;
- } else {
+
+ /*
+ * If the condition variable is statically initialized,
+ * perform the dynamic initialization:
+ */
+ else if (*cond != NULL ||
+ (rval = pthread_cond_init(cond,NULL)) == 0) {
/* Block signals: */
_thread_kern_sig_block(&status);
@@ -189,9 +195,15 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
int rval = 0;
int status;
- if (cond == NULL || *cond == NULL) {
+ if (cond == NULL)
rval = EINVAL;
- } else {
+
+ /*
+ * If the condition variable is statically initialized,
+ * perform the dynamic initialization:
+ */
+ else if (*cond != NULL ||
+ (rval = pthread_cond_init(cond,NULL)) == 0) {
/* Block signals: */
_thread_kern_sig_block(&status);