collectpads: Split out _check_pads into a version without lock taking.

This is so we can use _check_pads in places where we've already taken
the lock in question.

Partially fixes #590056
This commit is contained in:
Edward Hervey 2009-07-28 21:12:25 +02:00
parent 623c19983a
commit fcbba9b15a

View file

@ -88,6 +88,7 @@ static void gst_collect_pads_init (GstCollectPads * pads,
GstCollectPadsClass * g_class); GstCollectPadsClass * g_class);
static void ref_data (GstCollectData * data); static void ref_data (GstCollectData * data);
static void unref_data (GstCollectData * data); static void unref_data (GstCollectData * data);
static void gst_collect_pads_check_pads_unlocked (GstCollectPads * pads);
static void static void
gst_collect_pads_base_init (gpointer g_class) gst_collect_pads_base_init (gpointer g_class)
@ -992,10 +993,8 @@ gst_collect_pads_flush (GstCollectPads * pads, GstCollectData * data,
* Must be called with LOCK. * Must be called with LOCK.
*/ */
static void static void
gst_collect_pads_check_pads (GstCollectPads * pads) gst_collect_pads_check_pads_unlocked (GstCollectPads * pads)
{ {
/* the master list and cookie are protected with the PAD_LOCK */
GST_COLLECT_PADS_PAD_LOCK (pads);
GST_DEBUG ("stored cookie : %d, used_cookie:%d", GST_DEBUG ("stored cookie : %d, used_cookie:%d",
pads->abidata.ABI.pad_cookie, pads->cookie); pads->abidata.ABI.pad_cookie, pads->cookie);
if (G_UNLIKELY (pads->abidata.ABI.pad_cookie != pads->cookie)) { if (G_UNLIKELY (pads->abidata.ABI.pad_cookie != pads->cookie)) {
@ -1032,6 +1031,14 @@ gst_collect_pads_check_pads (GstCollectPads * pads)
/* and update the cookie */ /* and update the cookie */
pads->cookie = pads->abidata.ABI.pad_cookie; pads->cookie = pads->abidata.ABI.pad_cookie;
} }
}
static inline void
gst_collect_pads_check_pads (GstCollectPads * pads)
{
/* the master list and cookie are protected with the PAD_LOCK */
GST_COLLECT_PADS_PAD_LOCK (pads);
gst_collect_pads_check_pads_unlocked (pads);
GST_COLLECT_PADS_PAD_UNLOCK (pads); GST_COLLECT_PADS_PAD_UNLOCK (pads);
} }