mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
Document locking and its order
This commit is contained in:
parent
176f5dd0be
commit
b9d111372e
11 changed files with 32 additions and 28 deletions
|
@ -67,7 +67,7 @@ GST_DEBUG_CATEGORY_STATIC (rtsp_address_pool_debug);
|
|||
|
||||
struct _GstRTSPAddressPoolPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GMutex lock; /* protects everything in this struct */
|
||||
GList *addresses;
|
||||
GList *allocated;
|
||||
};
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
struct _GstRTSPAuthPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
gchar *basic;
|
||||
gchar *basic; /* protected by lock */
|
||||
GstRTSPMethod methods;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,9 +27,13 @@
|
|||
#define GST_RTSP_CLIENT_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientPrivate))
|
||||
|
||||
/* locking order:
|
||||
* send_lock, lock, tunnels_lock
|
||||
*/
|
||||
|
||||
struct _GstRTSPClientPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GMutex lock; /* protects everything else */
|
||||
GMutex send_lock;
|
||||
GstRTSPConnection *connection;
|
||||
GstRTSPWatch *watch;
|
||||
|
@ -38,9 +42,9 @@ struct _GstRTSPClientPrivate
|
|||
gboolean is_ipv6;
|
||||
gboolean use_client_settings;
|
||||
|
||||
GstRTSPClientSendFunc send_func;
|
||||
gpointer send_data;
|
||||
GDestroyNotify send_notify;
|
||||
GstRTSPClientSendFunc send_func; /* protected by send_lock */
|
||||
gpointer send_data; /* protected by send_lock */
|
||||
GDestroyNotify send_notify; /* protected by send_lock */
|
||||
|
||||
GstRTSPSessionPool *session_pool;
|
||||
GstRTSPMountPoints *mount_points;
|
||||
|
@ -54,7 +58,7 @@ struct _GstRTSPClientPrivate
|
|||
};
|
||||
|
||||
static GMutex tunnels_lock;
|
||||
static GHashTable *tunnels;
|
||||
static GHashTable *tunnels; /* protected by tunnels_lock */
|
||||
|
||||
#define DEFAULT_SESSION_POOL NULL
|
||||
#define DEFAULT_MOUNT_POINTS NULL
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
struct _GstRTSPMediaFactoryURIPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
gchar *uri;
|
||||
gchar *uri; /* protected by lock */
|
||||
gboolean use_gstpay;
|
||||
|
||||
GstCaps *raw_vcaps;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
struct _GstRTSPMediaFactoryPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GMutex lock; /* protects everything but medias */
|
||||
gchar *launch;
|
||||
gboolean shared;
|
||||
gboolean eos_shutdown;
|
||||
|
@ -38,7 +38,7 @@ struct _GstRTSPMediaFactoryPrivate
|
|||
GstRTSPAddressPool *pool;
|
||||
|
||||
GMutex medias_lock;
|
||||
GHashTable *medias;
|
||||
GHashTable *medias; /* protected by medias_lock */
|
||||
};
|
||||
|
||||
#define DEFAULT_LAUNCH NULL
|
||||
|
@ -799,9 +799,9 @@ no_launch:
|
|||
}
|
||||
parse_error:
|
||||
{
|
||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
||||
g_critical ("could not parse launch syntax (%s): %s", priv->launch,
|
||||
(error ? error->message : "unknown reason"));
|
||||
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
|
|
|
@ -33,6 +33,7 @@ struct _GstRTSPMediaPrivate
|
|||
GMutex lock;
|
||||
GCond cond;
|
||||
|
||||
/* protected by lock */
|
||||
gboolean shared;
|
||||
gboolean reusable;
|
||||
GstRTSPLowerTrans protocols;
|
||||
|
@ -43,17 +44,17 @@ struct _GstRTSPMediaPrivate
|
|||
GstRTSPAddressPool *pool;
|
||||
|
||||
GstElement *element;
|
||||
GRecMutex state_lock;
|
||||
GPtrArray *streams;
|
||||
GList *dynamic;
|
||||
GstRTSPMediaStatus status;
|
||||
GRecMutex state_lock; /* locking order: state lock, lock */
|
||||
GPtrArray *streams; /* protected by lock */
|
||||
GList *dynamic; /* protected by lock */
|
||||
GstRTSPMediaStatus status; /* protected by lock */
|
||||
gint prepare_count;
|
||||
gint n_active;
|
||||
gboolean adding;
|
||||
|
||||
/* the pipeline for the media */
|
||||
GstElement *pipeline;
|
||||
GstElement *fakesink;
|
||||
GstElement *fakesink; /* protected by lock */
|
||||
GSource *source;
|
||||
guint id;
|
||||
|
||||
|
@ -66,7 +67,7 @@ struct _GstRTSPMediaPrivate
|
|||
GstElement *rtpbin;
|
||||
|
||||
/* the range of media */
|
||||
GstRTSPTimeRange range;
|
||||
GstRTSPTimeRange range; /* protected by lock */
|
||||
GstClockTime range_start;
|
||||
GstClockTime range_stop;
|
||||
};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
struct _GstRTSPMountPointsPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GHashTable *mounts;
|
||||
GHashTable *mounts; /* protected by lock */
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GstRTSPMountPoints, gst_rtsp_mount_points, G_TYPE_OBJECT);
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
struct _GstRTSPServerPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GMutex lock; /* protects everything in this struct */
|
||||
|
||||
/* server information */
|
||||
gchar *address;
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
struct _GstRTSPSessionMediaPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GstRTSPUrl *url;
|
||||
GstRTSPMedia *media;
|
||||
GstRTSPState state;
|
||||
guint counter;
|
||||
GstRTSPUrl *url; /* unmutable */
|
||||
GstRTSPMedia *media; /* unmutable */
|
||||
GstRTSPState state; /* protected by lock */
|
||||
guint counter; /* protected by lock */
|
||||
|
||||
GPtrArray *transports;
|
||||
GPtrArray *transports; /* protected by lock */
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
@ -24,9 +24,8 @@
|
|||
|
||||
struct _GstRTSPSessionPoolPrivate
|
||||
{
|
||||
GMutex lock; /* protects everything in this struct */
|
||||
guint max_sessions;
|
||||
|
||||
GMutex lock;
|
||||
GHashTable *sessions;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
struct _GstRTSPSessionPrivate
|
||||
{
|
||||
GMutex lock;
|
||||
GMutex lock; /* protects everything but sessionid and create_time */
|
||||
gchar *sessionid;
|
||||
|
||||
guint timeout;
|
||||
GTimeVal create_time;
|
||||
GTimeVal create_time; /* immutable */
|
||||
GTimeVal last_access;
|
||||
gint expire_count;
|
||||
|
||||
|
|
Loading…
Reference in a new issue