svn commit: r238637 - head/lib/libthr/thread

David Xu davidxu at FreeBSD.org
Fri Jul 20 01:56:15 UTC 2012


Author: davidxu
Date: Fri Jul 20 01:56:14 2012
New Revision: 238637
URL: http://svn.freebsd.org/changeset/base/238637

Log:
  Don't forget to release a thread reference count,
  replace _thr_ref_add() with _thr_find_thread(),
  so reference count is no longer needed.
  
  MFC after:	3 days

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

Modified: head/lib/libthr/thread/thr_setschedparam.c
==============================================================================
--- head/lib/libthr/thread/thr_setschedparam.c	Fri Jul 20 01:41:18 2012	(r238636)
+++ head/lib/libthr/thread/thr_setschedparam.c	Fri Jul 20 01:56:14 2012	(r238637)
@@ -70,9 +70,8 @@ _pthread_setschedparam(pthread_t pthread
 			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);
+	} else if ((ret = _thr_find_thread(curthread, pthread,
+		 /*include dead*/0)) == 0) {
 		if (pthread->attr.sched_policy == policy &&
 		    (policy == SCHED_OTHER ||
 		     pthread->attr.prio == param->sched_priority)) {
@@ -88,7 +87,6 @@ _pthread_setschedparam(pthread_t pthread
 			pthread->attr.prio = param->sched_priority;
 		}
 		THR_THREAD_UNLOCK(curthread, pthread);
-		_thr_ref_delete(curthread, pthread);
 	}
 	return (ret);
 }


More information about the svn-src-head mailing list