* 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.
This commit is contained in:
Ulrich Drepper 2003-01-04 09:45:01 +00:00
parent d27a78be34
commit 29bc410c29
5 changed files with 38 additions and 12 deletions

View file

@ -1,5 +1,11 @@
2003-01-04 Ulrich Drepper <drepper@redhat.com>
* 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.
* pthreadP.h (pthread_cond_2_0_t): Remove unneeded lock element.
2003-01-03 Ulrich Drepper <drepper@redhat.com>

View file

@ -33,13 +33,18 @@ __pthread_cond_broadcast_2_0 (cond)
{
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. */

View file

@ -33,13 +33,18 @@ __pthread_cond_signal_2_0 (cond)
{
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. */

View file

@ -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. */

View file

@ -34,13 +34,18 @@ __pthread_cond_wait_2_0 (cond, mutex)
{
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. */