123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- #include <errno.h>
- #include "pthreadP.h"
- lll_lock_t __pthread_keys_lock = LLL_LOCK_INITIALIZER;
- int
- __pthread_key_create (key, destr)
- pthread_key_t *key;
- void (*destr) (void *);
- {
- int result = EAGAIN;
- size_t cnt;
- lll_lock (__pthread_keys_lock);
-
- for (cnt = 0; cnt < PTHREAD_KEYS_MAX; ++cnt)
- if (KEY_UNUSED (__pthread_keys[cnt].seq)
- && KEY_USABLE (__pthread_keys[cnt].seq))
- {
-
- ++__pthread_keys[cnt].seq;
-
- __pthread_keys[cnt].destr = destr;
-
- *key = cnt;
-
- result = 0;
-
- break;
- }
- lll_unlock (__pthread_keys_lock);
- return result;
- }
- strong_alias (__pthread_key_create, pthread_key_create)
- strong_alias (__pthread_key_create, __pthread_key_create_internal)
|