diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-01-04 09:45:01 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-01-04 09:45:01 +0000 |
commit | 29bc410c29ee2185bf91bf5fa923d8646ee9d501 (patch) | |
tree | 69cc5f9a071a5e1ab55d06cd5c222cc20ebae6b3 /nptl/old_pthread_cond_timedwait.c | |
parent | d27a78be343159b2a1b8e3856f3c51fdd0162c35 (diff) | |
download | glibc-29bc410c29ee2185bf91bf5fa923d8646ee9d501.tar.gz glibc-29bc410c29ee2185bf91bf5fa923d8646ee9d501.tar.xz glibc-29bc410c29ee2185bf91bf5fa923d8646ee9d501.zip |
Update.
* old_pthread_cond_broadcast.c: Optimize initialization a bit to work around gcc defficiencies. * old_pthread_cond_signal.c: Likewise. * old_pthread_cond_timedwait.c: Likewise. * old_pthread_cond_wait.c: Likewise.
Diffstat (limited to 'nptl/old_pthread_cond_timedwait.c')
-rw-r--r-- | nptl/old_pthread_cond_timedwait.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/nptl/old_pthread_cond_timedwait.c b/nptl/old_pthread_cond_timedwait.c index ef8047e1b8..b30e182b40 100644 --- a/nptl/old_pthread_cond_timedwait.c +++ b/nptl/old_pthread_cond_timedwait.c @@ -35,13 +35,18 @@ __pthread_cond_timedwait_2_0 (cond, mutex, abstime) { pthread_cond_t *newcond; +#if LLL_MUTEX_LOCK_INITIALIZER == 0 + newcond = (pthread_cond_t *) calloc (sizeof (pthread_cond_t), 1); + if (newcond == NULL) + return ENOMEM; +#else newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t)); if (newcond == NULL) return ENOMEM; - *newcond = (pthread_cond_t) PTHREAD_COND_INITIALIZER; - - atomic_write_barrier (); + /* Initialize the condvar. */ + (void) pthread_cond_init (newcond, NULL); +#endif if (atomic_compare_and_exchange_acq (&cond->cond, newcond, NULL) != 0) /* Somebody else just initialized the condvar. */ |