diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-09-13 07:03:01 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-09-13 07:03:01 +0000 |
commit | e87e922f3125332f002638f5f231acc7544b7ebf (patch) | |
tree | 82f35174d92e7167b6c95a574f45720b60ded582 /lib/libthr/thread/thr_attr.c | |
parent | 8ff2afea3997418eb503ad0843ed126e994fe54b (diff) | |
download | FreeBSD-src-e87e922f3125332f002638f5f231acc7544b7ebf.zip FreeBSD-src-e87e922f3125332f002638f5f231acc7544b7ebf.tar.gz |
Convert thread list lock from mutex to rwlock.
Diffstat (limited to 'lib/libthr/thread/thr_attr.c')
-rw-r--r-- | lib/libthr/thread/thr_attr.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c index bc6a891..fedf422 100644 --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -132,22 +132,23 @@ _pthread_attr_destroy(pthread_attr_t *attr) __weak_reference(_pthread_attr_get_np, pthread_attr_get_np); int -_pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst) +_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dst) { struct pthread *curthread; struct pthread_attr attr; int ret; - if (pid == NULL || dst == NULL || *dst == NULL) + if (pthread == NULL || dst == NULL || *dst == NULL) return (EINVAL); curthread = _get_curthread(); - if ((ret = _thr_ref_add(curthread, pid, /*include dead*/0)) != 0) + if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0)) != 0) return (ret); - attr = pid->attr; - if (pid->tlflags & TLFLAGS_DETACHED) + attr = pthread->attr; + if (pthread->flags & THR_FLAGS_DETACHED) attr.flags |= PTHREAD_DETACHED; - _thr_ref_delete(curthread, pid); + THR_THREAD_UNLOCK(curthread, pthread); + memcpy(*dst, &attr, sizeof(struct pthread_attr)); /* XXX */ (*dst)->cpuset = NULL; |