1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include <errno.h>
- #include <stdlib.h>
- #include "pthreadP.h"
- #include <atomic.h>
- #include <shlib-compat.h>
- #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
- int
- __pthread_cond_wait_2_0 (cond, mutex)
- pthread_cond_2_0_t *cond;
- pthread_mutex_t *mutex;
- {
- if (cond->cond == NULL)
- {
- 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;
-
- (void) pthread_cond_init (newcond, NULL);
- #endif
- if (atomic_compare_and_exchange_bool_acq (&cond->cond, newcond, NULL))
-
- free (newcond);
- }
- return __pthread_cond_wait (cond->cond, mutex);
- }
- compat_symbol (libpthread, __pthread_cond_wait_2_0, pthread_cond_wait,
- GLIBC_2_0);
- #endif
|