From owner-svn-src-stable@FreeBSD.ORG Wed Jul 25 01:57:54 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1E22F106564A; Wed, 25 Jul 2012 01:57:54 +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 07E1B8FC08; Wed, 25 Jul 2012 01:57:54 +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 q6P1vrnC097711; Wed, 25 Jul 2012 01:57:53 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6P1vrNI097708; Wed, 25 Jul 2012 01:57:53 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <201207250157.q6P1vrNI097708@svn.freebsd.org> From: David Xu Date: Wed, 25 Jul 2012 01:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238760 - stable/8/lib/libthr/thread X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 01:57:54 -0000 Author: davidxu Date: Wed Jul 25 01:57:53 2012 New Revision: 238760 URL: http://svn.freebsd.org/changeset/base/238760 Log: Revert r238715, the revision breaks firefox. Reported by: dougb Modified: stable/8/lib/libthr/thread/thr_setprio.c (contents, props changed) stable/8/lib/libthr/thread/thr_setschedparam.c (contents, props changed) Modified: stable/8/lib/libthr/thread/thr_setprio.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 01:05:49 2012 (r238759) +++ stable/8/lib/libthr/thread/thr_setprio.c Wed Jul 25 01:57:53 2012 (r238760) @@ -45,22 +45,38 @@ _pthread_setprio(pthread_t pthread, int int ret; param.sched_priority = prio; - if (pthread == curthread) + if (pthread == curthread) { THR_LOCK(curthread); - else if ((ret = _thr_find_thread(curthread, pthread, /*include dead*/0))) - return (ret); - if (pthread->attr.sched_policy == SCHED_OTHER || - pthread->attr.prio == prio) { - pthread->attr.prio = prio; - ret = 0; - } else { - ret = _thr_setscheduler(pthread->tid, - pthread->attr.sched_policy, ¶m); - if (ret == -1) - ret = errno; - else + if (curthread->attr.sched_policy == SCHED_OTHER || + curthread->attr.prio == prio) { + curthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(curthread->tid, + curthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else + curthread->attr.prio = prio; + } + THR_UNLOCK(curthread); + } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) + == 0) { + THR_THREAD_LOCK(curthread, pthread); + if (pthread->attr.sched_policy == SCHED_OTHER || + pthread->attr.prio == prio) { pthread->attr.prio = prio; + ret = 0; + } else { + ret = _thr_setscheduler(pthread->tid, + curthread->attr.sched_policy, ¶m); + if (ret == -1) + ret = errno; + else + pthread->attr.prio = prio; + } + THR_THREAD_UNLOCK(curthread, pthread); + _thr_ref_delete(curthread, pthread); } - THR_THREAD_UNLOCK(curthread, pthread); return (ret); } Modified: stable/8/lib/libthr/thread/thr_setschedparam.c ============================================================================== --- stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 01:05:49 2012 (r238759) +++ stable/8/lib/libthr/thread/thr_setschedparam.c Wed Jul 25 01:57:53 2012 (r238760) @@ -53,25 +53,42 @@ _pthread_setschedparam(pthread_t pthread struct pthread *curthread = _get_curthread(); int ret; - if (pthread == curthread) + if (pthread == curthread) { THR_LOCK(curthread); - else if ((ret = _thr_find_thread(curthread, pthread, - /*include dead*/0)) != 0) - return (ret); - if (pthread->attr.sched_policy == policy && - (policy == SCHED_OTHER || - pthread->attr.prio == param->sched_priority)) { - pthread->attr.prio = param->sched_priority; + if (curthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + curthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; + THR_UNLOCK(curthread); + return (0); + } + ret = _thr_setscheduler(curthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + curthread->attr.sched_policy = policy; + curthread->attr.prio = param->sched_priority; + } + THR_UNLOCK(curthread); + } else if ((ret = _thr_ref_add(curthread, pthread, /*include dead*/0)) + == 0) { + THR_THREAD_LOCK(curthread, pthread); + if (pthread->attr.sched_policy == policy && + (policy == SCHED_OTHER || + pthread->attr.prio == param->sched_priority)) { + pthread->attr.prio = param->sched_priority; + THR_THREAD_UNLOCK(curthread, pthread); + return (0); + } + ret = _thr_setscheduler(pthread->tid, policy, param); + if (ret == -1) + ret = errno; + else { + pthread->attr.sched_policy = policy; + pthread->attr.prio = param->sched_priority; + } THR_THREAD_UNLOCK(curthread, pthread); - return (0); + _thr_ref_delete(curthread, pthread); } - ret = _thr_setscheduler(pthread->tid, policy, param); - if (ret == -1) - ret = errno; - else { - pthread->attr.sched_policy = policy; - pthread->attr.prio = param->sched_priority; - } - THR_THREAD_UNLOCK(curthread, pthread); return (ret); }