element: inline the recursice state lock

This commit is contained in:
Wim Taymans 2011-06-02 14:09:46 +02:00
parent b5d35162ae
commit 9555a7f8d0
2 changed files with 5 additions and 12 deletions

View file

@ -285,8 +285,7 @@ gst_element_init (GstElement * element)
GST_STATE_RETURN (element) = GST_STATE_CHANGE_SUCCESS;
/* FIXME 0.11: Store this directly in the instance struct */
element->state_lock = g_slice_new (GStaticRecMutex);
g_static_rec_mutex_init (element->state_lock);
g_static_rec_mutex_init (&element->state_lock);
element->state_cond = g_cond_new ();
}
@ -2915,14 +2914,8 @@ gst_element_finalize (GObject * object)
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize");
GST_STATE_LOCK (element);
if (element->state_cond)
g_cond_free (element->state_cond);
element->state_cond = NULL;
GST_STATE_UNLOCK (element);
g_static_rec_mutex_free (element->state_lock);
g_slice_free (GStaticRecMutex, element->state_lock);
element->state_lock = NULL;
g_cond_free (element->state_cond);
g_static_rec_mutex_free (&element->state_lock);
GST_CAT_INFO_OBJECT (GST_CAT_REFCOUNTING, element, "finalize parent");

View file

@ -487,7 +487,7 @@ G_STMT_START { \
* This lock is used by the core. It is taken while getting or setting
* the state, during state changes, and while finalizing.
*/
#define GST_STATE_GET_LOCK(elem) (GST_ELEMENT_CAST(elem)->state_lock)
#define GST_STATE_GET_LOCK(elem) (&(GST_ELEMENT_CAST(elem)->state_lock))
/**
* GST_STATE_GET_COND:
* @elem: a #GstElement
@ -544,7 +544,7 @@ struct _GstElement
GstObject object;
/*< public >*/ /* with LOCK */
GStaticRecMutex *state_lock;
GStaticRecMutex state_lock;
/* element state */
GCond *state_cond;