[farsight2/master] Add data lock to FsParticipant
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:24:02 PST 2008
---
docs/libs/farsight2-libs-sections.txt | 2 ++
gst-libs/gst/farsight/fs-participant.c | 4 ++++
gst-libs/gst/farsight/fs-participant.h | 24 ++++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt
index 1042c2a..53f9e1d 100644
--- a/docs/libs/farsight2-libs-sections.txt
+++ b/docs/libs/farsight2-libs-sections.txt
@@ -3,6 +3,8 @@
<TITLE>FsParticipant</TITLE>
FsParticipant
FsParticipantClass
+FS_PARTICIPANT_DATA_LOCK
+FS_PARTICIPANT_DATA_UNLOCK
<SUBSECTION Standard>
FS_PARTICIPANT
FS_IS_PARTICIPANT
diff --git a/gst-libs/gst/farsight/fs-participant.c b/gst-libs/gst/farsight/fs-participant.c
index d43f493..dfccef2 100644
--- a/gst-libs/gst/farsight/fs-participant.c
+++ b/gst-libs/gst/farsight/fs-participant.c
@@ -141,6 +141,8 @@ fs_participant_init (FsParticipant *self)
/* member init */
self->priv = FS_PARTICIPANT_GET_PRIVATE (self);
self->priv->disposed = FALSE;
+
+ self->mutex = g_mutex_new ();
}
static void
@@ -169,6 +171,8 @@ fs_participant_finalize (GObject *object)
self->priv->cname = NULL;
}
+ g_mutex_free (self->mutex);
+
parent_class->finalize (object);
}
diff --git a/gst-libs/gst/farsight/fs-participant.h b/gst-libs/gst/farsight/fs-participant.h
index 0e30527..1b7cb11 100644
--- a/gst-libs/gst/farsight/fs-participant.h
+++ b/gst-libs/gst/farsight/fs-participant.h
@@ -79,11 +79,35 @@ struct _FsParticipant
/*< private >*/
+ GMutex *mutex;
+
FsParticipantPrivate *priv;
gpointer _padding[8];
};
+/**
+ * FS_PARTICIPANT_DATA_LOCK
+ * @participant: A #FsParticipant
+ *
+ * Locks the participant for data set with g_object_set_data() or
+ * g_object_set_qdata().
+ */
+
+#define FS_PARTICIPANT_DATA_LOCK(participant) \
+ g_mutex_lock ((participant)->mutex)
+
+/**
+ * FS_PARTICIPANT_DATA_UNLOCK
+ * @participant: A #FsParticipant
+ *
+ * Unlocks the participant for data set with g_object_set_data() or
+ * g_object_set_qdata().
+ */
+
+#define FS_PARTICIPANT_DATA_UNLOCK(participant) \
+ g_mutex_unlock ((participant)->mutex)
+
GType fs_participant_get_type (void);
G_END_DECLS
--
1.5.6.5
More information about the farsight-commits
mailing list