summaryrefslogtreecommitdiff
path: root/lib/libpthread/pthread_specific.c
diff options
context:
space:
mode:
authorad <ad@NetBSD.org>2007-12-01 01:19:31 +0000
committerad <ad@NetBSD.org>2007-12-01 01:19:31 +0000
commit64ebe1397e44e1c257cbcd08816411aa89c2f365 (patch)
treee2743c8eaaef33c1c47f5ff02c645a609207d05b /lib/libpthread/pthread_specific.c
parentb565a56cfbeafd2c6c21dd32fe5bba891d2d0a18 (diff)
Hack around ld.so initializing pthread users before libpthread/libc.
Diffstat (limited to 'lib/libpthread/pthread_specific.c')
-rw-r--r--lib/libpthread/pthread_specific.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libpthread/pthread_specific.c b/lib/libpthread/pthread_specific.c
index 1fe148e4ff8..9d39d72fbac 100644
--- a/lib/libpthread/pthread_specific.c
+++ b/lib/libpthread/pthread_specific.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_specific.c,v 1.13 2007/11/27 20:58:26 ad Exp $ */
+/* $NetBSD: pthread_specific.c,v 1.14 2007/12/01 01:19:31 ad Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_specific.c,v 1.13 2007/11/27 20:58:26 ad Exp $");
+__RCSID("$NetBSD: pthread_specific.c,v 1.14 2007/12/01 01:19:31 ad Exp $");
/* Functions and structures dealing with thread-specific data */
@@ -79,6 +79,8 @@ pthread_getspecific(pthread_key_t key)
unsigned int
pthread_curcpu_np(void)
{
-
- return pthread__self()->pt_lwpctl->lc_curcpu;
+ lwpctl_t *lc = pthread__self()->pt_lwpctl;
+ if (lc == NULL)
+ return 0;
+ return lc->lc_curcpu;
}