本文整理汇总了C++中G_UNLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ G_UNLOCK函数的具体用法?C++ G_UNLOCK怎么用?C++ G_UNLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_UNLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AdvanceTick
void AdvanceTick() {
Universe temp = g_queue_pop_head( universe_buffer );
while( temp == NULL ) {
// The buffer rendering process is taking too long.
// Let's wait until he's done, then try again.
G_LOCK( UNIVERSE_RENDER_BUSY );
G_UNLOCK( UNIVERSE_RENDER_BUSY );
temp = g_queue_pop_head( universe_buffer );
}
// Swap out the new guy for the "current" step, and free the old guy
Universe old = current;
current = temp;
Universe_freeUniverse( &old );
}
示例2: hamlib_set_ptt
void hamlib_set_ptt(gint ptt)
{
gint ret;
if (!rig || !hamlib_ptt)
return;
G_LOCK(hamlib_mutex);
ret = rig_set_ptt(rig, RIG_VFO_CURR, ptt ? RIG_PTT_ON : RIG_PTT_OFF);
if (ret != RIG_OK) {
errmsg(_("rig_set_ptt failed: %s.\nHamlib PTT disabled.\n"), rigerror(ret));
hamlib_ptt = FALSE;
}
G_UNLOCK(hamlib_mutex);
}
示例3: nautilus_progress_info_take_status
void
nautilus_progress_info_take_status (NautilusProgressInfo *info,
char *status)
{
G_LOCK (progress_info);
if (eel_strcmp (info->status, status) != 0) {
g_free (info->status);
info->status = status;
info->changed_at_idle = TRUE;
queue_idle (info, FALSE);
} else {
g_free (status);
}
G_UNLOCK (progress_info);
}
示例4: nautilus_progress_info_take_details
void
nautilus_progress_info_take_details (NautilusProgressInfo *info,
char *details)
{
G_LOCK (progress_info);
if (eel_strcmp (info->details, details) != 0) {
g_free (info->details);
info->details = details;
info->changed_at_idle = TRUE;
queue_idle (info, FALSE);
} else {
g_free (details);
}
G_UNLOCK (progress_info);
}
示例5: _shadowtorpreload_cryptoSetup
static void _shadowtorpreload_cryptoSetup(int numLocks) {
G_LOCK(shadowtorpreloadPrimaryLock);
if(!shadowtorpreloadGlobalState.initialized) {
shadowtorpreloadGlobalState.numCryptoThreadLocks = numLocks;
shadowtorpreloadGlobalState.cryptoThreadLocks = g_new0(GRWLock, numLocks);
for(gint i = 0; i < numLocks; i++) {
g_rw_lock_init(&(shadowtorpreloadGlobalState.cryptoThreadLocks[i]));
}
shadowtorpreloadGlobalState.initialized = TRUE;
}
shadowtorpreloadGlobalState.nThreads++;
G_UNLOCK(shadowtorpreloadPrimaryLock);
}
示例6: gst_mini_object_get_qdata
/**
* gst_mini_object_get_qdata:
* @object: The GstMiniObject to get a stored user data pointer from
* @quark: A #GQuark, naming the user data pointer
*
* This function gets back user data pointers stored via
* gst_mini_object_set_qdata().
*
* Returns: (transfer none): The user data pointer set, or %NULL
*/
gpointer
gst_mini_object_get_qdata (GstMiniObject * object, GQuark quark)
{
guint i;
gpointer result;
g_return_val_if_fail (object != NULL, NULL);
g_return_val_if_fail (quark > 0, NULL);
G_LOCK (qdata_mutex);
if ((i = find_notify (object, quark, FALSE, NULL, NULL)) != -1)
result = QDATA_DATA (object, i);
else
result = NULL;
G_UNLOCK (qdata_mutex);
return result;
}
示例7: _shadowtorpreload_cryptoTeardown
static void _shadowtorpreload_cryptoTeardown() {
G_LOCK(shadowtorpreloadPrimaryLock);
if(shadowtorpreloadGlobalState.initialized &&
shadowtorpreloadGlobalState.cryptoThreadLocks &&
--shadowtorpreloadGlobalState.nThreads == 0) {
for(int i = 0; i < shadowtorpreloadGlobalState.numCryptoThreadLocks; i++) {
g_rw_lock_clear(&(shadowtorpreloadGlobalState.cryptoThreadLocks[i]));
}
g_free(shadowtorpreloadGlobalState.cryptoThreadLocks);
shadowtorpreloadGlobalState.cryptoThreadLocks = NULL;
shadowtorpreloadGlobalState.initialized = 0;
}
G_UNLOCK(shadowtorpreloadPrimaryLock);
}
示例8: gst_mini_object_weak_unref
/**
* gst_mini_object_weak_unref: (skip)
* @object: #GstMiniObject to remove a weak reference from
* @notify: callback to search for
* @data: data to search for
*
* Removes a weak reference callback from a mini object.
*/
void
gst_mini_object_weak_unref (GstMiniObject * object,
GstMiniObjectNotify notify, gpointer data)
{
gint i;
g_return_if_fail (object != NULL);
g_return_if_fail (notify != NULL);
G_LOCK (qdata_mutex);
if ((i = find_notify (object, weak_ref_quark, TRUE, notify, data)) != -1) {
remove_notify (object, i);
} else {
g_warning ("%s: couldn't find weak ref %p (object:%p data:%p)", G_STRFUNC,
notify, object, data);
}
G_UNLOCK (qdata_mutex);
}
示例9: g_cache_node_new
static GCacheNode*
g_cache_node_new (gpointer value)
{
GCacheNode *node;
G_LOCK (node_mem_chunk);
if (!node_mem_chunk)
node_mem_chunk = g_mem_chunk_new ("cache node mem chunk", sizeof (GCacheNode),
1024, G_ALLOC_AND_FREE);
node = g_chunk_new (GCacheNode, node_mem_chunk);
G_UNLOCK (node_mem_chunk);
node->value = value;
node->ref_count = 1;
return node;
}
示例10: gst_net_client_clock_finalize
static void
gst_net_client_clock_finalize (GObject * object)
{
GstNetClientClock *self = GST_NET_CLIENT_CLOCK (object);
GList *l;
if (self->priv->synced_id)
g_signal_handler_disconnect (self->priv->internal_clock,
self->priv->synced_id);
self->priv->synced_id = 0;
G_LOCK (clocks_lock);
for (l = clocks; l; l = l->next) {
ClockCache *cache = l->data;
if (cache->clock == self->priv->internal_clock) {
cache->clocks = g_list_remove (cache->clocks, self);
if (cache->clocks) {
update_clock_cache (cache);
} else {
GstClock *sysclock = gst_system_clock_obtain ();
GstClockTime time = gst_clock_get_time (sysclock) + 60 * GST_SECOND;
cache->remove_id = gst_clock_new_single_shot_id (sysclock, time);
gst_clock_id_wait_async (cache->remove_id, remove_clock_cache, cache,
NULL);
gst_object_unref (sysclock);
}
break;
}
}
G_UNLOCK (clocks_lock);
g_free (self->priv->address);
self->priv->address = NULL;
if (self->priv->bus != NULL) {
gst_object_unref (self->priv->bus);
self->priv->bus = NULL;
}
G_OBJECT_CLASS (gst_net_client_clock_parent_class)->finalize (object);
}
示例11: ev_job_scheduler_update_job
void
ev_job_scheduler_update_job (EvJob *job,
EvJobPriority priority)
{
GSList *l;
EvSchedulerJob *s_job = NULL;
gboolean need_resort = FALSE;
/* Main loop jobs are scheduled inmediately */
if (ev_job_get_run_mode (job) == EV_JOB_RUN_MAIN_LOOP)
return;
ev_debug_message (DEBUG_JOBS, "%s pirority %d", EV_GET_TYPE_NAME (job), priority);
G_LOCK (job_list);
for (l = job_list; l; l = l->next) {
s_job = (EvSchedulerJob *)l->data;
if (s_job->job == job) {
need_resort = (s_job->priority != priority);
break;
}
}
G_UNLOCK (job_list);
if (need_resort) {
GList *list;
g_mutex_lock (&job_queue_mutex);
list = g_queue_find (job_queue[s_job->priority], s_job);
if (list) {
ev_debug_message (DEBUG_JOBS, "Moving job %s from pirority %d to %d",
EV_GET_TYPE_NAME (job), s_job->priority, priority);
g_queue_delete_link (job_queue[s_job->priority], list);
g_queue_push_tail (job_queue[priority], s_job);
g_cond_broadcast (&job_queue_cond);
}
g_mutex_unlock (&job_queue_mutex);
}
}
示例12: _parse_uri
static gboolean _parse_uri(const char* uri, gboolean* secure, char** host, char** resource)
{
static GRegex* regex = NULL;
GMatchInfo *match_info = NULL;
g_return_val_if_fail(uri != NULL, FALSE);
g_return_val_if_fail(secure != NULL, FALSE);
g_return_val_if_fail(host != NULL, FALSE);
g_return_val_if_fail(resource != NULL, FALSE);
// precompile regexp
G_LOCK(regex);
if (regex == NULL)
regex = g_regex_new("^([a-z]+)://([a-z0-9.-]+(:([0-9]+))?)(/.+)?$", G_REGEX_CASELESS, 0, NULL);
G_UNLOCK(regex);
if (!g_regex_match(regex, uri, 0, &match_info))
{
g_match_info_free(match_info);
return FALSE;
}
// check schema
char* schema = g_match_info_fetch(match_info, 1);
if (!g_ascii_strcasecmp("http", schema))
*secure = 0;
else if (!g_ascii_strcasecmp("https", schema))
*secure = 1;
else
{
g_free(schema);
g_match_info_free(match_info);
return FALSE;
}
g_free(schema);
*host = g_match_info_fetch(match_info, 2);
*resource = g_match_info_fetch(match_info, 5);
if (*resource == NULL)
*resource = g_strdup("/RPC2");
g_match_info_free(match_info);
return TRUE;
}
示例13: mime_cache_reload
gboolean mime_cache_reload( MimeCache* cache )
{
int i;
gboolean ret = mime_cache_load( cache, cache->file_path );
/* recalculate max magic extent */
for( i = 0; i < n_caches; ++i )
{
if( caches[i]->magic_max_extent > mime_cache_max_extent )
mime_cache_max_extent = caches[i]->magic_max_extent;
}
G_LOCK( mime_magic_buf );
mime_magic_buf = g_realloc( mime_magic_buf, mime_cache_max_extent );
G_UNLOCK( mime_magic_buf );
return ret;
}
示例14: g_static_private_free
/**
* g_static_private_free:
* @private_key: a #GStaticPrivate to be freed
*
* Releases all resources allocated to @private_key.
*
* You don't have to call this functions for a #GStaticPrivate with an
* unbounded lifetime, i.e. objects declared 'static', but if you have
* a #GStaticPrivate as a member of a structure and the structure is
* freed, you should also free the #GStaticPrivate.
*/
void
g_static_private_free (GStaticPrivate *private_key)
{
guint idx = private_key->index;
if (!idx)
return;
private_key->index = 0;
/* Freeing the per-thread data is deferred to either the
* thread end or the next g_static_private_get() call for
* the same index.
*/
G_LOCK (g_thread);
g_thread_free_indices = g_slist_prepend (g_thread_free_indices,
GUINT_TO_POINTER (idx));
G_UNLOCK (g_thread);
}
示例15: crypto_global_init
int crypto_global_init(int useAccel, const char *accelName, const char *accelDir) {
G_LOCK(shadowtorpreloadPrimaryLock);
shadowtorpreloadGlobalState.nTorCryptoNodes++;
gint result = 0;
if(!shadowtorpreloadGlobalState.sslInitializedGlobal) {
shadowtorpreloadGlobalState.sslInitializedGlobal = TRUE;
if(_shadowtorpreload_getWorker()->tor.tor_ssl_global_init) {
_shadowtorpreload_getWorker()->tor.tor_ssl_global_init();
}
if(_shadowtorpreload_getWorker()->tor.crypto_global_init) {
result = _shadowtorpreload_getWorker()->tor.crypto_global_init(useAccel, accelName, accelDir);
}
}
G_UNLOCK(shadowtorpreloadPrimaryLock);
return result;
}