diff options
| author | John Birrell <jb@FreeBSD.org> | 1999-05-23 10:55:33 +0000 |
|---|---|---|
| committer | John Birrell <jb@FreeBSD.org> | 1999-05-23 10:55:33 +0000 |
| commit | eb9dc34d8b2b38586a59ff6c59674d9cd672b7d8 (patch) | |
| tree | 2fe6e193ddad102e2e7fa9b046a21b09325219b4 /lib/libpthread/thread/thr_cond.c | |
| parent | d47066829aa3b417818cef2c14ee1b7c96c6b566 (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_cond.c')
| -rw-r--r-- | lib/libpthread/thread/thr_cond.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/libpthread/thread/thr_cond.c b/lib/libpthread/thread/thr_cond.c index c090d7984139..e0360dde1b4c 100644 --- a/lib/libpthread/thread/thr_cond.c +++ b/lib/libpthread/thread/thr_cond.c @@ -146,6 +146,15 @@ pthread_cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex) */ else if (*cond != NULL || (rval = pthread_cond_init(cond,NULL)) == 0) { + /* + * If the condvar was statically allocated, properly + * initialize the tail queue. + */ + if (((*cond)->c_flags & COND_FLAGS_INITED) == 0) { + TAILQ_INIT(&(*cond)->c_queue); + (*cond)->c_flags |= COND_FLAGS_INITED; + } + /* Lock the condition variable structure: */ _SPINLOCK(&(*cond)->lock); @@ -238,6 +247,16 @@ pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, */ else if (*cond != NULL || (rval = pthread_cond_init(cond,NULL)) == 0) { + /* + * If the condvar was statically allocated, properly + * initialize the tail queue. + */ + if (((*cond)->c_flags & COND_FLAGS_INITED) == 0) { + TAILQ_INIT(&(*cond)->c_queue); + (*cond)->c_flags |= COND_FLAGS_INITED; + } + + /* Lock the condition variable structure: */ _SPINLOCK(&(*cond)->lock); |
