diff options
| author | yamt <yamt@NetBSD.org> | 2008-01-07 11:51:43 +0000 |
|---|---|---|
| committer | yamt <yamt@NetBSD.org> | 2008-01-07 11:51:43 +0000 |
| commit | 48a1e4cf4637cf4e8cafc6caadad66323323a738 (patch) | |
| tree | 4d7a40f8681d3e70af14a33e373c6e08ef96efc6 /lib/libpthread/pthread_specific.c | |
| parent | 2e8a5bee6869b36db2cf73bc39123dbaf1bed731 (diff) | |
pthread_curcpu_np: map LWPCTL_CPU_NONE to 0 so that this works in the case
of _lwp_ctl failure.
Diffstat (limited to 'lib/libpthread/pthread_specific.c')
| -rw-r--r-- | lib/libpthread/pthread_specific.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libpthread/pthread_specific.c b/lib/libpthread/pthread_specific.c index 6596bee74c2..9edfb3f102a 100644 --- a/lib/libpthread/pthread_specific.c +++ b/lib/libpthread/pthread_specific.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_specific.c,v 1.15 2007/12/07 20:36:52 ad Exp $ */ +/* $NetBSD: pthread_specific.c,v 1.16 2008/01/07 11:51:43 yamt Exp $ */ /*- * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pthread_specific.c,v 1.15 2007/12/07 20:36:52 ad Exp $"); +__RCSID("$NetBSD: pthread_specific.c,v 1.16 2008/01/07 11:51:43 yamt Exp $"); /* Functions and structures dealing with thread-specific data */ @@ -79,5 +79,11 @@ pthread_getspecific(pthread_key_t key) unsigned int pthread_curcpu_np(void) { - return pthread__self()->pt_lwpctl->lc_curcpu; + unsigned int cpu = pthread__self()->pt_lwpctl->lc_curcpu; + + /* for pthread__dummy_lwpctl */ + if (cpu == LWPCTL_CPU_NONE) + return 0; + + return cpu; } |
