summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2007-11-26 02:35:17 +0000
committerDavid Xu <davidxu@FreeBSD.org>2007-11-26 02:35:17 +0000
commiteb326f14a2bd0a312924826be15121dc8b20eccb (patch)
treebab20b0536042f877db7abec0d244fda529d698b
parent89396d2512eb557c9939bc410ca72f1b96abf535 (diff)
Notes
-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 1cfe1b1dcad70..f373d8ee1bf8f 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);