Index: trunk/psLib/src/sys/psMutex.h
===================================================================
--- trunk/psLib/src/sys/psMutex.h	(revision 19232)
+++ trunk/psLib/src/sys/psMutex.h	(revision 21349)
@@ -17,15 +17,24 @@
 
 // These bells and whistles are only defined if PS_MUTEX_CAREFUL and __USE_GNU are both defined
-#define PS_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK_NP // Error-checking mutex
-#define PS_MUTEX_TRACE(LEVEL, STRING, PTR) psTrace("psLib.sys.mutex", LEVEL, STRING, #PTR); // Trace message
-#define PS_MUTEX_TRACE_THREAD(LEVEL, STRING, PTR) \ // Trace message with thread and pointer
-    psTrace("psLib.sys.mutex", LEVEL, STRING, (void*)pthread_self(), #PTR);
-#define PS_MUTEX_CHECK_DEADLOCK() \     // Check for dead-locked mutex
+
+// Error-checking mutex
+#define PS_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK_NP
+
+#define PS_MUTEX_TRACE(LEVEL, STRING, PTR) psTrace("psLib.sys.mutex", LEVEL, STRING, #PTR, (unsigned long) PTR); // Trace message
+
+// Trace message with thread and pointer
+#define PS_MUTEX_TRACE_THREAD(LEVEL, STRING, PTR) \
+    psTrace("psLib.sys.mutex", LEVEL, STRING, (void*)pthread_self(), #PTR, (unsigned long) PTR);
+
+// Check for dead-locked mutex
+#define PS_MUTEX_CHECK_DEADLOCK(PTR) \
     if (pml == EDEADLK) { \
-        psAbort("Deadlocked mutex on %s", #PTR); \
+        psAbort("Deadlocked mutex on %s (%lx)", #PTR, (unsigned long) PTR); \
     }
-#define PS_MUTEX_CHECK_STOLEN(PTR) \       // Check for stolen mutex
+
+// Check for stolen mutex
+#define PS_MUTEX_CHECK_STOLEN(PTR) \
     if (pmu == EPERM) { \
-        psAbort("Unlocking stolen mutex on %s", #PTR); \
+        psAbort("Unlocking stolen mutex on %s (%lx)", #PTR, (unsigned long) PTR);	\
     }
 
@@ -53,5 +62,5 @@
 #define psMutexInit(PTR) { \
     psAssert(PTR, "Require non-NULL pointer to initialise mutex"); \
-    PS_MUTEX_TRACE(3, "Initialising mutex on %s...", PTR); \
+    PS_MUTEX_TRACE(3, "Initialising mutex on %s (%lx)...", PTR); \
     /* Gotta go the long way, since we can't use PTHREAD_MUTEX_INITIALIZER after we declare the variable */ \
     pthread_mutexattr_t attr; /* Mutex attributes */ \
@@ -65,9 +74,9 @@
 #define psMutexLock(PTR) { \
     psAssert(PTR, "Require non-NULL pointer to lock mutex"); \
-    PS_MUTEX_TRACE_THREAD(1, "Thread %p waiting for mutex lock on %s...", PTR); \
+    PS_MUTEX_TRACE_THREAD(1, "Thread %p waiting for mutex lock on %s (%lx)...", PTR); \
     int pml = pthread_mutex_lock(&(PTR)->lock); \
-    PS_MUTEX_TRACE_THREAD(1, "Thread %p locked mutex on %s", PTR); \
+    PS_MUTEX_TRACE_THREAD(1, "Thread %p locked mutex on %s (%lx)", PTR); \
     if (pml == EINVAL) { \
-        psAbort("Cannot lock mutex on %s: not initialised", #PTR); \
+        psAbort("Cannot lock mutex on %s (%lx): not initialised", #PTR, (unsigned long) PTR); \
     } \
     PS_MUTEX_CHECK_DEADLOCK(PTR); \
@@ -77,8 +86,8 @@
 #define psMutexUnlock(PTR) { \
     psAssert(PTR, "Require non-NULL pointer to unlock mutex"); \
-    PS_MUTEX_TRACE_THREAD(1, "Thread %p unlocking mutex on %s", PTR); \
+    PS_MUTEX_TRACE_THREAD(1, "Thread %p unlocking mutex on %s (%lx)", PTR); \
     int pmu = pthread_mutex_unlock(&(PTR)->lock); \
     if (pmu == EINVAL) { \
-        psAbort("Cannot unlock mutex on %s: not initialised", #PTR); \
+        psAbort("Cannot unlock mutex on %s (%lx): not initialised", #PTR, (unsigned long) PTR); \
     } \
     PS_MUTEX_CHECK_STOLEN(PTR); \
@@ -89,5 +98,5 @@
     psAssert(PTR, "Require non-NULL pointer to destroy mutex"); \
     if (pthread_mutex_destroy(&(PTR)->lock) == EBUSY) { \
-        psAbort("Cannot destroy mutex on %s: is busy", #PTR); \
+        psAbort("Cannot destroy mutex on %s (%lx): is busy", #PTR, (unsigned long) PTR);	\
     } \
 }
