2008-02-01 Wim Taymans <wim.taymans@collabora.co.uk>
+ * gst/gstminiobject.c: (gst_mini_object_replace):
+ When replacing a miniobject, do a quick equality check first so that we
+ can avoid a ref/unref pair.
+
+2008-02-01 Wim Taymans <wim.taymans@collabora.co.uk>
+
* docs/design/part-synchronisation.txt:
Update some docs.
newdata, newdata ? newdata->refcount : 0);
#endif
+ olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
+
+ if (olddata_val == newdata)
+ return;
+
if (newdata)
gst_mini_object_ref (newdata);
- do {
+ while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata,
+ olddata_val, newdata)) {
olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
- } while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata,
- olddata_val, newdata));
+ }
if (olddata_val)
gst_mini_object_unref (olddata_val);