Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Jul 2012 03:37:20 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238644 - head/lib/libthr/thread
Message-ID:  <201207200337.q6K3bKN3052229@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidxu
Date: Fri Jul 20 03:37:19 2012
New Revision: 238644
URL: http://svn.freebsd.org/changeset/base/238644

Log:
  Simplify code by replacing _thr_ref_add() with _thr_find_thread().

Modified:
  head/lib/libthr/thread/thr_info.c

Modified: head/lib/libthr/thread/thr_info.c
==============================================================================
--- head/lib/libthr/thread/thr_info.c	Fri Jul 20 03:27:07 2012	(r238643)
+++ head/lib/libthr/thread/thr_info.c	Fri Jul 20 03:37:19 2012	(r238644)
@@ -51,16 +51,12 @@ _pthread_set_name_np(pthread_t thread, c
 		if (thr_set_name(thread->tid, name))
 			ret = errno;
 	} else {
-		if (_thr_ref_add(curthread, thread, 0) == 0) {
-			THR_THREAD_LOCK(curthread, thread);
+		if ((ret=_thr_find_thread(curthread, thread, 0)) == 0) {
 			if (thread->state != PS_DEAD) {
 				if (thr_set_name(thread->tid, name))
 					ret = errno;
 			}
 			THR_THREAD_UNLOCK(curthread, thread);
-			_thr_ref_delete(curthread, thread);
-		} else {
-			ret = ESRCH;
 		}
 	}
 #if 0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207200337.q6K3bKN3052229>