summaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorMike Brady <mikebrady@eircom.net>2018-11-19 20:12:57 +0000
committerMike Brady <mikebrady@eircom.net>2018-11-19 20:12:57 +0000
commitf7342a70dff4af9a0759fb464b1e21138b2c45fa (patch)
tree38fa5fac2f8df4d81f05a1e1dc5de6f53ef4f7b2 /common.h
parent0052389d1ed1e16988d45bcc4e0f80993aa7e13d (diff)
Add the sort-of mutex name to the debug_mutex_lock and _unlock. Also, setting the debug level to 0 turns off the debug logging of them. Handy.
Diffstat (limited to 'common.h')
-rw-r--r--common.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/common.h b/common.h
index 81aab4c..2fec4c2 100644
--- a/common.h
+++ b/common.h
@@ -299,20 +299,20 @@ int sps_pthread_mutex_timedlock(pthread_mutex_t *mutex, useconds_t dally_time,
const char *debugmessage, int debuglevel);
// wait for the specified time, checking every 20 milliseconds, and block if it can't acquire the
// lock
-int _debug_mutex_lock(pthread_mutex_t *mutex, useconds_t dally_time, const char *filename,
+int _debug_mutex_lock(pthread_mutex_t *mutex, useconds_t dally_time, const char *mutexName, const char *filename,
const int line, int debuglevel);
-#define debug_mutex_lock(mu, t, d) _debug_mutex_lock(mu, t, __FILE__, __LINE__, d)
+#define debug_mutex_lock(mu, t, d) _debug_mutex_lock(mu, t, #mu , __FILE__, __LINE__, d)
-int _debug_mutex_unlock(pthread_mutex_t *mutex, const char *filename, const int line,
+int _debug_mutex_unlock(pthread_mutex_t *mutex, const char *mutexName, const char *filename, const int line,
int debuglevel);
-#define debug_mutex_unlock(mu, d) _debug_mutex_unlock(mu, __FILE__, __LINE__, d)
+#define debug_mutex_unlock(mu, d) _debug_mutex_unlock(mu, #mu, __FILE__, __LINE__, d)
void pthread_cleanup_debug_mutex_unlock(void *arg);
#define pthread_cleanup_debug_mutex_lock(mu, t, d) \
- if (_debug_mutex_lock(mu, t, __FILE__, __LINE__, d) == 0) \
+ if (_debug_mutex_lock(mu, t, #mu, __FILE__, __LINE__, d) == 0) \
pthread_cleanup_push(pthread_cleanup_debug_mutex_unlock, (void *)mu)
char *get_version_string(); // mallocs a string space -- remember to free it afterwards