12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #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_signal_2_0 (cond)
- pthread_cond_2_0_t *cond;
- {
- 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_signal (cond->cond);
- }
- compat_symbol (libpthread, __pthread_cond_signal_2_0, pthread_cond_signal,
- GLIBC_2_0);
- #endif
|