if (priv->parent)
priv = priv->parent->priv;
- g_static_rec_mutex_lock(&priv->mutex);
+ g_rec_mutex_lock(&priv->mutex);
}
static void
if (priv->parent)
priv = priv->parent->priv;
- g_static_rec_mutex_unlock(&priv->mutex);
+ g_rec_mutex_unlock(&priv->mutex);
}
static void
gst_vaapi_display_destroy(display);
- g_static_rec_mutex_free(&display->priv->mutex);
+ g_rec_mutex_clear(&display->priv->mutex);
G_OBJECT_CLASS(gst_vaapi_display_parent_class)->finalize(object);
}
priv->properties = NULL;
priv->create_display = TRUE;
- g_static_rec_mutex_init(&priv->mutex);
+ g_rec_mutex_init(&priv->mutex);
}
/**
};
struct _GstVaapiDisplayCache {
- GStaticMutex mutex;
+ GMutex mutex;
GList *list;
};
#define CACHE_LOOKUP(cache, res, prop, comp_func, comp_data, user_data) do { \
GList *l; \
\
- g_static_mutex_lock(&(cache)->mutex); \
+ g_mutex_lock(&(cache)->mutex); \
for (l = (cache)->list; l != NULL; l = l->next) { \
GstVaapiDisplayInfo * const info = \
&((CacheEntry *)l->data)->info; \
if (comp_func(info->prop, comp_data, user_data)) \
break; \
} \
- g_static_mutex_unlock(&(cache)->mutex); \
+ g_mutex_unlock(&(cache)->mutex); \
res = l; \
} while (0)
if (!cache)
return NULL;
- g_static_mutex_init(&cache->mutex);
+ g_mutex_init(&cache->mutex);
return cache;
}
g_list_free(cache->list);
cache->list = NULL;
}
- g_static_mutex_free(&cache->mutex);
+ g_mutex_clear(&cache->mutex);
g_slice_free(GstVaapiDisplayCache, cache);
}
g_return_val_if_fail(cache != NULL, 0);
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
size = g_list_length(cache->list);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
return size;
}
if (!entry)
return FALSE;
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
cache->list = g_list_prepend(cache->list, entry);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
return TRUE;
}
return;
cache_entry_free(m->data);
- g_static_mutex_lock(&cache->mutex);
+ g_mutex_lock(&cache->mutex);
cache->list = g_list_delete_link(cache->list, m);
- g_static_mutex_unlock(&cache->mutex);
+ g_mutex_unlock(&cache->mutex);
}
/**
GLVTable *
gl_get_vtable(void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
- static gboolean gl_vtable_init = TRUE;
+ static gsize gl_vtable_init = FALSE;
static GLVTable *gl_vtable = NULL;
- g_static_mutex_lock(&mutex);
- if (gl_vtable_init) {
- gl_vtable_init = FALSE;
- gl_vtable = gl_init_vtable();
+ if (g_once_init_enter(&gl_vtable_init)) {
+ gl_vtable = gl_init_vtable();
+ g_once_init_leave(&gl_vtable_init, TRUE);
}
- g_static_mutex_unlock(&mutex);
return gl_vtable;
}