diff options
| author | cl <cl@NetBSD.org> | 2004-03-14 01:19:41 +0000 |
|---|---|---|
| committer | cl <cl@NetBSD.org> | 2004-03-14 01:19:41 +0000 |
| commit | f2f106648cb994804efdc8a9f457a642815d8272 (patch) | |
| tree | 10126518767faefa83c91ddc96be71ebe9be015c /lib/libpthread/pthread_lock.c | |
| parent | ea5ec0212d715373eb56dbdeb218b9504e1139f2 (diff) | |
add libpthread part of concurrency support for SA on MP systems
- enable concurrency according to environment variable PTHREAD_CONCURRENCY
- add idle VP wakeup if there are additional jobs and idle VPs
- make reidlequeue per VP
- enable spinning for locks
- fix race condition in alarm processing
- fix race condition in mutex locking
- make debugging output line buffered and add VP prefix to debug lines
Diffstat (limited to 'lib/libpthread/pthread_lock.c')
| -rw-r--r-- | lib/libpthread/pthread_lock.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/libpthread/pthread_lock.c b/lib/libpthread/pthread_lock.c index a5a5eed638f..5303fe821f7 100644 --- a/lib/libpthread/pthread_lock.c +++ b/lib/libpthread/pthread_lock.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_lock.c,v 1.10 2004/03/03 21:06:07 thorpej Exp $ */ +/* $NetBSD: pthread_lock.c,v 1.11 2004/03/14 01:19:42 cl Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -37,11 +37,10 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pthread_lock.c,v 1.10 2004/03/03 21:06:07 thorpej Exp $"); +__RCSID("$NetBSD: pthread_lock.c,v 1.11 2004/03/14 01:19:42 cl Exp $"); -#include <sys/param.h> +#include <sys/lock.h> #include <sys/ras.h> -#include <sys/sysctl.h> #include <errno.h> #include <unistd.h> @@ -56,7 +55,7 @@ __RCSID("$NetBSD: pthread_lock.c,v 1.10 2004/03/03 21:06:07 thorpej Exp $"); #endif /* How many times to try before checking whether we've been continued. */ -#define NSPINS 1 /* no point in actually spinning until MP works */ +#define NSPINS 1000 /* no point in actually spinning until MP works */ static int nspins = NSPINS; @@ -136,18 +135,9 @@ const struct pthread_lock_ops *pthread__lock_ops = &pthread__lock_ops_ras; * we fall back onto machine-dependent atomic lock primitives. */ void -pthread__lockprim_init(void) +pthread__lockprim_init(int ncpu) { - int mib[2]; - size_t len; - int ncpu; - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - - len = sizeof(ncpu); - sysctl(mib, 2, &ncpu, &len, NULL, 0); - if (ncpu == 1 && rasctl(RAS_ADDR(pthread__lock), RAS_SIZE(pthread__lock), RAS_INSTALL) == 0) { pthread__lock_ops = &pthread__lock_ops_ras; |
