summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorDavid Xu <davidxu@FreeBSD.org>2007-11-26 02:52:20 +0000
committerDavid Xu <davidxu@FreeBSD.org>2007-11-26 02:52:20 +0000
commitb4d58a20fd91f61635945b7f32c33602ea53a037 (patch)
treef67522db1af3352fea55587f4ac4805c5667099e /lib/libpthread
parent265d576fc9e8de5f10b2310d7ade14cc4433681f (diff)
Notes
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_spec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_spec.c b/lib/libpthread/thread/thr_spec.c
index 6c2b6367c651..abe0c40f2911 100644
--- a/lib/libpthread/thread/thr_spec.c
+++ b/lib/libpthread/thread/thr_spec.c
@@ -50,9 +50,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++) {