Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jul 2012 01:57:53 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r238760 - stable/8/lib/libthr/thread
Message-ID:  <201207250157.q6P1vrNI097708@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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, &param);
-		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, &param);
+			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, &param);
+			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);
 }



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