docs/gst/gstreamer-sections.txt: Doc updates.
authorAndy Wingo <wingo@pobox.com>
Mon, 10 Oct 2005 14:23:26 +0000 (14:23 +0000)
committerAndy Wingo <wingo@pobox.com>
Mon, 10 Oct 2005 14:23:26 +0000 (14:23 +0000)
Original commit message from CVS:
2005-10-10  Andy Wingo  <wingo@pobox.com>

* docs/gst/gstreamer-sections.txt: Doc updates.

* gst/gstutils.h:
* gst/gstutils.c (g_static_rec_cond_timed_wait)
(g_static_rec_cond_wait): Ported from state changes patch, while
we wait on bug #317802 to be solved in a well-distributed GLib.

ChangeLog
docs/gst/gstreamer-sections.txt
gst/gstutils.c
gst/gstutils.h

index 40b9e5f..2be107a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-10-10  Andy Wingo  <wingo@pobox.com>
 
+       * docs/gst/gstreamer-sections.txt: Doc updates.
+
        * gst/gstelement.c (gst_element_change_state_func): Renamed from
        gst_element_change_state, variable name changes.
        (gst_element_change_state): Split out of gst_element_set_state in
index e930f23..70d1e0c 100644 (file)
@@ -2033,7 +2033,10 @@ gst_util_dump_mem
 gst_util_uint64_scale
 gst_util_set_object_arg
 gst_util_set_value_from_string
+g_static_rec_cond_timed_wait
+g_static_rec_cond_wait
 <SUBSECTION Private>
+GST_COMPILE_STATIC_REC_COND_WAIT
 GST_HAVE_UNALIGNED_ACCESS
 </SECTION>
 
index b8723d0..a366d6a 100644 (file)
@@ -1816,6 +1816,65 @@ gst_object_default_error (GstObject * source, GError * error, gchar * debug)
   g_free (name);
 }
 
+#ifdef GST_COMPILE_STATIC_REC_COND_WAIT
+
+#if GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P
+# define g_system_thread_equal_simple(thread1, thread2)                 \
+   ((thread1).dummy_pointer == (thread2).dummy_pointer)
+# define g_system_thread_assign(dest, src)                              \
+   ((dest).dummy_pointer = (src).dummy_pointer)
+#else /* GLIB_SIZEOF_SYSTEM_THREAD != SIZEOF_VOID_P */
+# define g_system_thread_equal_simple(thread1, thread2)                 \
+   (memcmp (&(thread1), &(thread2), GLIB_SIZEOF_SYSTEM_THREAD) == 0)
+# define g_system_thread_assign(dest, src)                              \
+   (memcpy (&(dest), &(src), GLIB_SIZEOF_SYSTEM_THREAD))
+#endif /* GLIB_SIZEOF_SYSTEM_THREAD == SIZEOF_VOID_P */
+
+#define g_system_thread_equal(thread1, thread2)                         \
+  (g_thread_functions_for_glib_use.thread_equal ?                       \
+   g_thread_functions_for_glib_use.thread_equal (&(thread1), &(thread2)) :\
+   g_system_thread_equal_simple((thread1), (thread2)))
+
+static GSystemThread zero_thread;
+
+gboolean
+g_static_rec_cond_timed_wait (GCond * cond,
+    GStaticRecMutex * mutex, GTimeVal * end_time)
+{
+  GMutex *smutex;
+  guint depth;
+  GSystemThread self;
+  gboolean res;
+
+  if (!g_thread_supported ())
+    return FALSE;
+
+  G_THREAD_UF (thread_self, (&self));
+
+  g_return_val_if_fail (g_system_thread_equal (self, mutex->owner), FALSE);
+
+  depth = mutex->depth;
+
+  g_system_thread_assign (mutex->owner, zero_thread);
+  mutex->depth = 0;
+  smutex = g_static_mutex_get_mutex (&mutex->mutex);
+
+  res = g_cond_timed_wait (cond, smutex, end_time);
+
+  g_system_thread_assign (mutex->owner, self);
+  mutex->depth = depth;
+
+  return res;
+}
+
+void
+g_static_rec_cond_wait (GCond * cond, GStaticRecMutex * mutex)
+{
+  g_static_rec_cond_timed_wait (cond, mutex, NULL);
+}
+
+#endif /* GST_COMPILE_STATIC_REC_COND_WAIT */
+
 /**
  * gst_bin_add_many:
  * @bin: the bin to add the elements to
index 3d84d65..3bd1acb 100644 (file)
@@ -457,6 +457,15 @@ GST_BOILERPLATE_FULL (type, type_as_function, parent_type,              \
 void                   gst_object_default_error        (GstObject * source,
                                                         GError * error, gchar * debug);
 
+/* rec mutex */
+#ifndef g_static_rec_cond_wait
+#define GST_COMPILE_STATIC_REC_COND_WAIT
+void                   g_static_rec_cond_wait          (GCond                *cond,
+                                                        GStaticRecMutex      *mutex);
+gboolean               g_static_rec_cond_timed_wait    (GCond                *cond,
+                                                        GStaticRecMutex      *mutex,
+                                                        GTimeVal             *end_time);
+#endif
 
 /* element functions */
 GstFlowReturn          gst_element_abort_preroll       (GstElement *element);