diff options
| author | ad <ad@NetBSD.org> | 2007-03-02 17:40:55 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-03-02 17:40:55 +0000 |
| commit | dc39f9ec83784d35bc75dc9d9a7461b6cbdffefe (patch) | |
| tree | adfd09d50357297c22cfe49fb1ff9e7157a5a9c9 /lib/libpthread/pthread.c | |
| parent | 1bcb6087a6c8b1df6b8adea68e9ba6eac1237453 (diff) | |
pthread_detach: acquire the join lock before changing pt_flags.
Diffstat (limited to 'lib/libpthread/pthread.c')
| -rw-r--r-- | lib/libpthread/pthread.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libpthread/pthread.c b/lib/libpthread/pthread.c index fdf2bd4329f..8419853a6ff 100644 --- a/lib/libpthread/pthread.c +++ b/lib/libpthread/pthread.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread.c,v 1.62 2007/02/21 22:31:38 ad Exp $ */ +/* $NetBSD: pthread.c,v 1.63 2007/03/02 17:40:55 ad Exp $ */ /*- * Copyright (c) 2001, 2002, 2003, 2006, 2007 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: pthread.c,v 1.62 2007/02/21 22:31:38 ad Exp $"); +__RCSID("$NetBSD: pthread.c,v 1.63 2007/03/02 17:40:55 ad Exp $"); #include <err.h> #include <errno.h> @@ -69,7 +69,7 @@ __RCSID("$NetBSD: pthread.c,v 1.62 2007/02/21 22:31:38 ad Exp $"); #define PTHREAD__UNPARK_MAX 128 /* How many times to try acquiring spin locks on MP systems. */ -#define PTHREAD__NSPINS 1000 +#define PTHREAD__NSPINS 1024 static void pthread__create_tramp(void *(*start)(void *), void *arg); static void pthread__dead(pthread_t, pthread_t); @@ -943,7 +943,9 @@ pthread_detach(pthread_t thread) return 0; #else + pthread_spinlock(self, &self->pt_join_lock); thread->pt_flags |= PT_FLAG_DETACHED; + pthread_spinunlock(self, &self->pt_join_lock); return _lwp_detach(thread->pt_lid); #endif } |
