aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/ChangeLog3
-rw-r--r--e-util/e-msgport.c8
-rw-r--r--e-util/e-msgport.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 027717987e..ab679f24f4 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,5 +1,8 @@
2001-05-01 Dan Winship <danw@ximian.com>
+ * e-msgport.c (e_mutex_assert_locked): Debugging routine. (Only
+ works for recursive mutexes right now.)
+
* e-html-utils.c (e_text_to_html_full): Don't use g_utf8_next_char
on text that isn't valid UTF8, since it won't work (and might even
get into an infinite loop).
diff --git a/e-util/e-msgport.c b/e-util/e-msgport.c
index 683aa85d78..d034f0deaf 100644
--- a/e-util/e-msgport.c
+++ b/e-util/e-msgport.c
@@ -758,6 +758,14 @@ int e_mutex_unlock(EMutex *m)
return -1;
}
+void e_mutex_assert_locked(EMutex *m)
+{
+ g_return_if_fail (m->type == E_MUTEX_REC);
+ pthread_mutex_lock(&m->mutex);
+ g_assert(m->owner == pthread_self());
+ pthread_mutex_unlock(&m->mutex);
+}
+
#ifdef STANDALONE
EMsgPort *server_port;
diff --git a/e-util/e-msgport.h b/e-util/e-msgport.h
index 6e25235bbd..d181ac7fb7 100644
--- a/e-util/e-msgport.h
+++ b/e-util/e-msgport.h
@@ -77,5 +77,6 @@ EMutex *e_mutex_new(e_mutex_t type);
int e_mutex_destroy(EMutex *m);
int e_mutex_lock(EMutex *m);
int e_mutex_unlock(EMutex *m);
+void e_mutex_assert_locked(EMutex *m);
#endif