Index: docs/reference/glib/glib-sections.txt
===================================================================
RCS file: /cvs/gnome/glib/docs/reference/glib/glib-sections.txt,v
retrieving revision 1.153
diff -u -p -r1.153 glib-sections.txt
--- docs/reference/glib/glib-sections.txt	15 Dec 2006 22:58:04 -0000	1.153
+++ docs/reference/glib/glib-sections.txt	19 Dec 2006 01:55:42 -0000
@@ -566,6 +566,7 @@ g_static_rec_mutex_trylock
 g_static_rec_mutex_unlock
 g_static_rec_mutex_lock_full
 g_static_rec_mutex_unlock_full
+g_static_rec_mutex_get_depth
 g_static_rec_mutex_free
 
 <SUBSECTION>
Index: docs/reference/glib/tmpl/glib-unused.sgml
===================================================================
RCS file: /cvs/gnome/glib/docs/reference/glib/tmpl/glib-unused.sgml,v
retrieving revision 1.39
diff -u -p -r1.39 glib-unused.sgml
--- docs/reference/glib/tmpl/glib-unused.sgml	5 May 2005 14:57:27 -0000	1.39
+++ docs/reference/glib/tmpl/glib-unused.sgml	19 Dec 2006 01:55:42 -0000
@@ -815,6 +815,17 @@ type of source.
 @data: 
 @notify: 
 
+<!-- ##### FUNCTION g_static_rec_mutex_get_depth ##### -->
+<para>
+Returns the number of times @mutex has been locked by the current
+thread. If @mutex is unlocked or was locked by another thread, the
+function returns 0.
+</para>
+
+@mutex: a #GStaticRecMutex.
+@Returns: number of times @mutex has been locked by the current thread.
+@Since: 2.14
+
 <!-- ##### MACRO g_string ##### -->
 <para>
 Turns the argument into a string literal by using the '#' stringizing operator.
Index: glib/gthread.c
===================================================================
RCS file: /cvs/gnome/glib/glib/gthread.c,v
retrieving revision 1.54
diff -u -p -r1.54 gthread.c
--- glib/gthread.c	23 May 2006 01:33:16 -0000	1.54
+++ glib/gthread.c	19 Dec 2006 01:55:46 -0000
@@ -346,6 +346,24 @@ g_static_rec_mutex_unlock_full (GStaticR
   return depth;
 }
 
+guint
+g_static_rec_mutex_get_depth (GStaticRecMutex *mutex)
+{
+  GSystemThread self;
+
+  g_return_val_if_fail (mutex, 0);
+
+  if (!g_thread_supported ())
+    return 1;
+
+  G_THREAD_UF (thread_self, (&self));
+
+  if (g_system_thread_equal (self, mutex->owner))
+    return mutex->depth;
+
+  return 0;
+}
+
 void
 g_static_rec_mutex_free (GStaticRecMutex *mutex)
 {
Index: glib/gthread.h
===================================================================
RCS file: /cvs/gnome/glib/glib/gthread.h,v
retrieving revision 1.27
diff -u -p -r1.27 gthread.h
--- glib/gthread.h	11 May 2006 00:18:46 -0000	1.27
+++ glib/gthread.h	19 Dec 2006 01:55:46 -0000
@@ -264,6 +264,7 @@ void     g_static_rec_mutex_unlock      
 void     g_static_rec_mutex_lock_full   (GStaticRecMutex *mutex,
                                          guint            depth);
 guint    g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex);
+guint    g_static_rec_mutex_get_depth   (GStaticRecMutex *mutex);
 void     g_static_rec_mutex_free        (GStaticRecMutex *mutex);
 
 typedef struct _GStaticRWLock GStaticRWLock;
