1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20: #include <errno.h>
21: #include <stdlib.h>
22: #include "pthreadP.h"
23: #include <atomic.h>
24: #include <shlib-compat.h>
25:
26:
27: #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
28: int
29: __pthread_cond_broadcast_2_0 (cond)
30: pthread_cond_2_0_t *cond;
31: {
32: if (cond->cond == NULL)
33: {
34: pthread_cond_t *newcond;
35:
36: #if LLL_LOCK_INITIALIZER == 0
37: newcond = (pthread_cond_t *) calloc (sizeof (pthread_cond_t), 1);
38: if (newcond == NULL)
39: return ENOMEM;
40: #else
41: newcond = (pthread_cond_t *) malloc (sizeof (pthread_cond_t));
42: if (newcond == NULL)
43: return ENOMEM;
44:
45:
46: (void) pthread_cond_init (newcond, NULL);
47: #endif
48:
49: if (atomic_compare_and_exchange_bool_acq (&cond->cond, newcond, NULL))
50:
51: free (newcond);
52: }
53:
54: return __pthread_cond_broadcast (cond->cond);
55: }
56: compat_symbol (libpthread, __pthread_cond_broadcast_2_0,
57: pthread_cond_broadcast, GLIBC_2_0);
58: #endif