summaryrefslogtreecommitdiffstats
path: root/lib/libkse
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2007-11-26 02:35:17 +0000
committerdavidxu <davidxu@FreeBSD.org>2007-11-26 02:35:17 +0000
commit2179631991e01f5cac08108afc2fb3758fa63d30 (patch)
treebab20b0536042f877db7abec0d244fda529d698b /lib/libkse
parentbae95962d033bd47ab35fb4a2990caa045fecced (diff)
downloadFreeBSD-src-2179631991e01f5cac08108afc2fb3758fa63d30.zip
FreeBSD-src-2179631991e01f5cac08108afc2fb3758fa63d30.tar.gz
Move the added code in revision 1.26 into function pthread_key_create,
it should be there.
Diffstat (limited to 'lib/libkse')
-rw-r--r--lib/libkse/thread/thr_spec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/libkse/thread/thr_spec.c b/lib/libkse/thread/thr_spec.c
index 1cfe1b1..f373d8e 100644
--- a/lib/libkse/thread/thr_spec.c
+++ b/lib/libkse/thread/thr_spec.c
@@ -63,9 +63,13 @@ __weak_reference(_pthread_setspecific, pthread_setspecific);
int
_pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
{
- struct pthread *curthread = _get_curthread();
+ struct pthread *curthread;
int i;
+ if (_thr_initial == NULL)
+ _libpthread_init(NULL);
+ curthread = _get_curthread();
+
/* Lock the key table: */
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
for (i = 0; i < PTHREAD_KEYS_MAX; i++) {
@@ -90,13 +94,9 @@ _pthread_key_create(pthread_key_t *key, void (*destructor) (void *))
int
_pthread_key_delete(pthread_key_t key)
{
- struct pthread *curthread;
+ struct pthread *curthread = _get_curthread();
int ret = 0;
- if (_thr_initial == NULL)
- _libpthread_init(NULL);
- curthread = _get_curthread();
-
if ((unsigned int)key < PTHREAD_KEYS_MAX) {
/* Lock the key table: */
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
OpenPOWER on IntegriCloud