mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
gst/gstminiobject.c: When replacing a miniobject, do a quick equality check first so that we can avoid a ref/unref pair.
Original commit message from CVS: * 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.
This commit is contained in:
parent
698ecfc5fd
commit
6f0a59aa13
2 changed files with 14 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
|||
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:
|
||||
|
|
|
@ -364,13 +364,18 @@ gst_mini_object_replace (GstMiniObject ** olddata, GstMiniObject * newdata)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue