From owner-svn-src-all@FreeBSD.ORG Fri Jul 20 03:37:20 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 961AC106566B; Fri, 20 Jul 2012 03:37:20 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 802308FC18; Fri, 20 Jul 2012 03:37:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6K3bKUb052231; Fri, 20 Jul 2012 03:37:20 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6K3bKN3052229; Fri, 20 Jul 2012 03:37:20 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207200337.q6K3bKN3052229@svn.freebsd.org> From: David Xu Date: Fri, 20 Jul 2012 03:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238644 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 03:37:20 -0000 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