Date: Thu, 31 May 2012 11:25:46 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r236807 - soc2012/gmiller/locking-head/lib/libthr/thread Message-ID: <20120531112546.E89E61065678@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gmiller Date: Thu May 31 11:25:46 2012 New Revision: 236807 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236807 Log: Make the mutex parameter (m) explicit for MUTEX_OBTAIN_SUCCESS() and MUTEX_OBTAIN_FAILED() for consistency and readability. Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Thu May 31 11:07:14 2012 (r236806) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Thu May 31 11:25:46 2012 (r236807) @@ -325,12 +325,12 @@ ret = _thr_umutex_trylock(&m->m_lock, id); if (__predict_true(ret == 0)) { ENQUEUE_MUTEX(curthread, m); - MUTEX_OBTAIN_SUCCESS(); + MUTEX_OBTAIN_SUCCESS(m); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m _PROFILE_PASS); - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); } else { - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); } if (ret && (m->m_flags & PMUTEX_FLAG_PRIVATE)) @@ -360,7 +360,7 @@ if (m->m_owner == curthread) return mutex_self_lock(m, abstime _PROFILE_PASS); - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); id = TID(curthread); /* @@ -415,7 +415,7 @@ done: if (ret == 0) { ENQUEUE_MUTEX(curthread, m); - MUTEX_OBTAIN_SUCCESS(); + MUTEX_OBTAIN_SUCCESS(m); } return (ret); @@ -434,7 +434,7 @@ ENQUEUE_MUTEX(curthread, m); ret = 0; - MUTEX_OBTAIN_SUCCESS(); + MUTEX_OBTAIN_SUCCESS(m); } else { ret = mutex_lock_sleep(curthread, m, abstime _PROFILE_PASS); } @@ -568,9 +568,9 @@ } if (ret == 0) { - MUTEX_OBTAIN_SUCCESS(); + MUTEX_OBTAIN_SUCCESS(m); } else { - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); } return (ret); @@ -586,7 +586,7 @@ switch (PMUTEX_TYPE(m->m_flags)) { case PTHREAD_MUTEX_ERRORCHECK: case PTHREAD_MUTEX_ADAPTIVE_NP: - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); if (abstime) { if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 || @@ -612,7 +612,7 @@ * What SS2 define as a 'normal' mutex. Intentionally * deadlock on attempts to get a lock you already own. */ - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); ret = 0; if (abstime) { @@ -640,7 +640,7 @@ ret = 0; } else { ret = EAGAIN; - MUTEX_OBTAIN_FAILED(); + MUTEX_OBTAIN_FAILED(m); } break; @@ -650,7 +650,7 @@ } if (ret == 0) { - MUTEX_OBTAIN_SUCCESS(); + MUTEX_OBTAIN_SUCCESS(m); } return (ret); Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Thu May 31 11:07:14 2012 (r236806) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Thu May 31 11:25:46 2012 (r236807) @@ -807,14 +807,14 @@ void _pthread_cancel_leave(int maycancel); #ifdef LOCK_PROFILING -#define MUTEX_OBTAIN_SUCCESS() \ +#define MUTEX_OBTAIN_SUCCESS(m) \ _mutex_obtain_success(m, file, line) -#define MUTEX_OBTAIN_FAILED() \ +#define MUTEX_OBTAIN_FAILED(m) \ _mutex_obtain_failed(m, file, line) #define MUTEX_RELEASE(m) _mutex_release(m) #else -#define MUTEX_OBTAIN_SUCCESS() do { } while (0) -#define MUTEX_OBTAIN_FAILED() do { } while (0) +#define MUTEX_OBTAIN_SUCCESS(m) do { } while (0) +#define MUTEX_OBTAIN_FAILED(m) do { } while (0) #define MUTEX_RELEASE(m) do { } while (0) #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120531112546.E89E61065678>