Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Nov 2002 11:09:58 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 20531 for review
Message-ID:  <200211011909.gA1J9weB036750@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=20531

Change 20531 by jhb@jhb_laptop on 2002/11/01 11:09:10

	A few extra points for readability.

Affected files ...

.. //depot/projects/smpng/sys/kern/kern_mutex.c#54 edit

Differences ...

==== //depot/projects/smpng/sys/kern/kern_mutex.c#54 (text+ko) ====

@@ -481,14 +481,16 @@
 _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
 {
 	struct thread *td = curthread;
+	struct thread *td1;
 #if defined(SMP) && defined(ADAPTIVE_MUTEXES)
 	struct thread *owner;
 #endif
+	uintptr_t v;
 #ifdef KTR
 	int cont_logged = 0;
 #endif
 
-	if ((m->mtx_lock & MTX_FLAGMASK) == (uintptr_t)td) {
+	if (mtx_owned(m)) {
 		m->mtx_recurse++;
 		atomic_set_ptr(&m->mtx_lock, MTX_RECURSED);
 		if (LOCK_LOG_TEST(&m->mtx_object, opts))
@@ -502,15 +504,15 @@
 		    m->mtx_object.lo_name, (void *)m->mtx_lock, file, line);
 
 	while (!_obtain_lock(m, td)) {
-		uintptr_t v;
-		struct thread *td1;
 
 		mtx_lock_spin(&sched_lock);
+		v = m->mtx_lock;
+
 		/*
 		 * Check if the lock has been released while spinning for
 		 * the sched_lock.
 		 */
-		if ((v = m->mtx_lock) == MTX_UNOWNED) {
+		if (v == MTX_UNOWNED) {
 			mtx_unlock_spin(&sched_lock);
 #ifdef __i386__
 			ia32_pause();

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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