• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ G_UNLOCK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中G_UNLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ G_UNLOCK函数的具体用法?C++ G_UNLOCK怎么用?C++ G_UNLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了G_UNLOCK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 );

}
开发者ID:rmartz,项目名称:Gravitation-Engine,代码行数:18,代码来源:Simulator.c


示例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);
}
开发者ID:Mohamad-Mosadeghzad,项目名称:gmfsk-0.8.test1-jcb,代码行数:18,代码来源:hamlib.c


示例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);
}
开发者ID:rn10950,项目名称:FVWM95-Updated,代码行数:18,代码来源:nautilus-progress-info.c


示例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);
}
开发者ID:rn10950,项目名称:FVWM95-Updated,代码行数:18,代码来源:nautilus-progress-info.c


示例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);
}
开发者ID:voynix,项目名称:shadow-plugin-tor,代码行数:18,代码来源:shadowtor-preload.c


示例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;
}
开发者ID:tieto,项目名称:gstreamer-pkg,代码行数:28,代码来源:gstminiobject.c


示例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);
}
开发者ID:voynix,项目名称:shadow-plugin-tor,代码行数:18,代码来源:shadowtor-preload.c


示例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);
}
开发者ID:GrokImageCompression,项目名称:gstreamer,代码行数:26,代码来源:gstminiobject.c


示例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;
}
开发者ID:jmckaskill,项目名称:subversion,代码行数:18,代码来源:gcache.c


示例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);
}
开发者ID:GrokImageCompression,项目名称:gstreamer,代码行数:44,代码来源:gstnetclientclock.c


示例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);
	}
}
开发者ID:4eremuxa,项目名称:evince,代码行数:44,代码来源:ev-job-scheduler.c


示例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;
}
开发者ID:zonio,项目名称:libxr,代码行数:44,代码来源:xr-client.c


示例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;
}
开发者ID:BwackNinja,项目名称:spacefm,代码行数:19,代码来源:mime-type.c


示例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);
}
开发者ID:QuentinFiard,项目名称:glib,代码行数:30,代码来源:gthread-deprecated.c


示例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;
}
开发者ID:voynix,项目名称:shadow-plugin-tor,代码行数:19,代码来源:shadowtor-preload.c


示例16: gst_alsa_device_property_probe_get_properties

static const GList *
gst_alsa_device_property_probe_get_properties (GstPropertyProbe * probe)
{
  GObjectClass *klass = G_OBJECT_GET_CLASS (probe);
  static GList *list = NULL;

  G_LOCK (probe_lock);

  if (!list) {
    GParamSpec *pspec;

    pspec = g_object_class_find_property (klass, "device");
    list = g_list_append (NULL, pspec);
  }

  G_UNLOCK (probe_lock);

  return list;
}
开发者ID:ConfusedReality,项目名称:pkg_multimedia_gst-plugins-base,代码行数:19,代码来源:gstalsadeviceprobe.c


示例17: hamlib_close

void hamlib_close(void)
{
	if (rig == NULL)
		return;

	/* tell the hamlib thread to kill it self */
	hamlib_exit = TRUE;

	/* and the wait for it to die */
	pthread_join(hamlib_thread, NULL);

	hamlib_exit = FALSE;

	G_LOCK(hamlib_mutex);
	rig_close(rig);
	rig_cleanup(rig);
	rig = NULL;
	G_UNLOCK(hamlib_mutex);
}
开发者ID:Mohamad-Mosadeghzad,项目名称:gmfsk-0.8.test1-jcb,代码行数:19,代码来源:hamlib.c


示例18: g_time_zone_unref

/**
 * g_time_zone_unref:
 * @tz: a #GTimeZone
 *
 * Decreases the reference count on @tz.
 *
 * Since: 2.26
 **/
void
g_time_zone_unref (GTimeZone *tz)
{
  g_assert (tz->ref_count > 0);

  if (g_atomic_int_dec_and_test (&tz->ref_count))
    {
      G_LOCK(time_zones);
      g_hash_table_remove (time_zones, tz->name);
      G_UNLOCK(time_zones);

      if (tz->zoneinfo)
        g_buffer_unref (tz->zoneinfo);

      g_free (tz->name);

      g_slice_free (GTimeZone, tz);
    }
}
开发者ID:eugenis,项目名称:glib-nacl,代码行数:27,代码来源:gtimezone.c


示例19: dup_client

/* Return a reference to the #Client for @watcher_id, or %NULL if it’s been
 * unwatched. This is safe to call from any thread. */
static Client *
dup_client (guint watcher_id)
{
  Client *client;

  G_LOCK (lock);

  g_assert (watcher_id != 0);
  g_assert (map_id_to_client != NULL);

  client = g_hash_table_lookup (map_id_to_client, GUINT_TO_POINTER (watcher_id));

  if (client != NULL)
    client_ref (client);

  G_UNLOCK (lock);

  return client;
}
开发者ID:GNOME,项目名称:glib,代码行数:21,代码来源:gdbusnamewatching.c


示例20: vfs_connection_closed

static void
vfs_connection_closed (GDBusConnection *connection,
                       gboolean remote_peer_vanished,
                       GError *error,
                       gpointer user_data)
{
    VfsConnectionData *connection_data;

    connection_data = g_object_get_data (G_OBJECT (connection), "connection_data");
    g_assert (connection_data != NULL);

    if (connection_data->async_dbus_id)
    {
        _g_daemon_vfs_invalidate_dbus_id (connection_data->async_dbus_id);
        G_LOCK (async_map);
        g_hash_table_remove (async_map, connection_data->async_dbus_id);
        G_UNLOCK (async_map);
    }
}
开发者ID:ondrejholy,项目名称:gvfs,代码行数:19,代码来源:gvfsdaemondbus.c



注:本文中的G_UNLOCK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_UseTargets函数代码示例发布时间:2022-05-30
下一篇:
C++ G_UNLIKELY函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap