您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_UNLOCK函数代码示例

51自学网 2021-06-01 21:02:17
  C++
这篇教程C++ G_UNLOCK函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例3: nautilus_progress_info_take_status

voidnautilus_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,


示例4: nautilus_progress_info_take_details

voidnautilus_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,


示例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,


示例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 */gpointergst_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,


示例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,


示例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. */voidgst_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,


示例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,


示例10: gst_net_client_clock_finalize

static voidgst_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,


示例11: ev_job_scheduler_update_job

voidev_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,


示例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,


示例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,


示例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. */voidg_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,


示例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,


示例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,


示例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,


示例18: g_time_zone_unref

/** * g_time_zone_unref: * @tz: a #GTimeZone * * Decreases the reference count on @tz. * * Since: 2.26 **/voidg_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,


示例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,


示例20: vfs_connection_closed

static voidvfs_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,


示例21: pka_manager_load_plugins

/** * pka_manager_load_plugins: * @plugins_dir: The directory containing plugins. * * Loads plugins discovered in @plugins_dir. * * Returns: None. * Side effects: Plugins are loaded into process. */static voidpka_manager_load_plugins (const gchar *plugins_dir) /* IN */{	GError *error = NULL;	PkaPlugin *plugin;	const gchar *name;	gchar *path;	GDir *dir;	ENTRY;	INFO(Plugin, "Loading plugins from directory: %s", plugins_dir);	if (!(dir = g_dir_open(plugins_dir, 0, &error))) {		WARNING(Manager, "%s", error->message);		g_error_free(error);		GOTO(cleanup);	}	while ((name = g_dir_read_name(dir))) {		if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {			DEBUG(Plugin, "Skipping non-plugin: %s", name);			continue;		}		INFO(Manager, "Discovered plugin: %s", name);		path = g_build_filename(plugins_dir, name, NULL);		plugin = pka_plugin_new();		if (!pka_plugin_load_from_file(plugin, path, &error)) {			WARNING(Plugin, "%s", error->message);			g_object_unref(plugin);			g_error_free(error);			error = NULL;			GOTO(next);		}		G_LOCK(plugins);		g_ptr_array_add(manager.plugins, plugin);		G_UNLOCK(plugins);	  next:		g_free(path);	}  cleanup:  	if (dir) {  		g_dir_close(dir);	}	EXIT;}
开发者ID:stieg,项目名称:perfkit,代码行数:52,


示例22: g_cancellable_release_fd

/** * g_cancellable_release_fd: * @cancellable: a #GCancellable * * Releases a resources previously allocated by g_cancellable_get_fd() * or g_cancellable_make_pollfd(). * * For compatibility reasons with older releases, calling this function  * is not strictly required, the resources will be automatically freed * when the @cancellable is finalized. However, the @cancellable will * block scarce file descriptors until it is finalized if this function * is not called. This can cause the application to run out of file  * descriptors when many #GCancellables are used at the same time. *  * Since: 2.22 **/voidg_cancellable_release_fd (GCancellable *cancellable){  GCancellablePrivate *priv;  if (cancellable == NULL)    return;  g_return_if_fail (G_IS_CANCELLABLE (cancellable));  g_return_if_fail (cancellable->priv->fd_refcount > 0);  priv = cancellable->priv;  G_LOCK (cancellable);  priv->fd_refcount--;  if (priv->fd_refcount == 0)    g_cancellable_close_pipe (cancellable);  G_UNLOCK (cancellable);}
开发者ID:nikolatesla,项目名称:BitchXMPP,代码行数:35,


示例23: on_housekeeping_timeout

/* called from the main thread on start-up and every 10 minutes or so */static gbooleanon_housekeeping_timeout (gpointer user_data){  UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);  G_LOCK (provider_lock);  if (provider->housekeeping_running)    goto out;  provider->housekeeping_running = TRUE;  g_io_scheduler_push_job (housekeeping_thread_func,                           g_object_ref (provider),                           (GDestroyNotify) g_object_unref,                           G_PRIORITY_DEFAULT,                           NULL); out:  G_UNLOCK (provider_lock);  return TRUE; /* keep timeout around */}
开发者ID:GinoM,项目名称:eudisk,代码行数:20,


示例24: g_bus_watch_name

/** * g_bus_watch_name: * @bus_type: The type of bus to watch a name on. * @name: The name (well-known or unique) to watch. * @flags: Flags from the #GBusNameWatcherFlags enumeration. * @name_appeared_handler: (nullable): Handler to invoke when @name is known to exist or %NULL. * @name_vanished_handler: (nullable): Handler to invoke when @name is known to not exist or %NULL. * @user_data: User data to pass to handlers. * @user_data_free_func: (nullable): Function for freeing @user_data or %NULL. * * Starts watching @name on the bus specified by @bus_type and calls * @name_appeared_handler and @name_vanished_handler when the name is * known to have a owner respectively known to lose its * owner. Callbacks will be invoked in the * [thread-default main context][g-main-context-push-thread-default] * of the thread you are calling this function from. * * You are guaranteed that one of the handlers will be invoked after * calling this function. When you are done watching the name, just * call g_bus_unwatch_name() with the watcher id this function * returns. * * If the name vanishes or appears (for example the application owning * the name could restart), the handlers are also invoked. If the * #GDBusConnection that is used for watching the name disconnects, then * @name_vanished_handler is invoked since it is no longer * possible to access the name. * * Another guarantee is that invocations of @name_appeared_handler * and @name_vanished_handler are guaranteed to alternate; that * is, if @name_appeared_handler is invoked then you are * guaranteed that the next time one of the handlers is invoked, it * will be @name_vanished_handler. The reverse is also true. * * This behavior makes it very simple to write applications that want * to take action when a certain [name exists][gdbus-watching-names]. * Basically, the application should create object proxies in * @name_appeared_handler and destroy them again (if any) in * @name_vanished_handler. * * Returns: An identifier (never 0) that an be used with * g_bus_unwatch_name() to stop watching the name. * * Since: 2.26 */guintg_bus_watch_name (GBusType                  bus_type,                  const gchar              *name,                  GBusNameWatcherFlags      flags,                  GBusNameAppearedCallback  name_appeared_handler,                  GBusNameVanishedCallback  name_vanished_handler,                  gpointer                  user_data,                  GDestroyNotify            user_data_free_func){  Client *client;  g_return_val_if_fail (g_dbus_is_name (name), 0);  G_LOCK (lock);  client = g_new0 (Client, 1);  client->ref_count = 1;  client->id = g_atomic_int_add (&next_global_id, 1); /* TODO: uh oh, handle overflow */  client->name = g_strdup (name);  client->flags = flags;  client->name_appeared_handler = name_appeared_handler;  client->name_vanished_handler = name_vanished_handler;  client->user_data = user_data;  client->user_data_free_func = user_data_free_func;  client->main_context = g_main_context_ref_thread_default ();  if (map_id_to_client == NULL)    {      map_id_to_client = g_hash_table_new (g_direct_hash, g_direct_equal);    }  g_hash_table_insert (map_id_to_client,                       GUINT_TO_POINTER (client->id),                       client);  g_bus_get (bus_type,             NULL,             connection_get_cb,             client_ref (client));  G_UNLOCK (lock);  return client->id;}
开发者ID:GNOME,项目名称:glib,代码行数:88,


示例25: g_main_dispatch

/* HOLDS: main_loop_lock */static voidg_main_dispatch (GTimeVal *dispatch_time){  while (pending_dispatches != NULL)    {      gboolean need_destroy;      GSource *source = pending_dispatches->data;      GSList *tmp_list;      tmp_list = pending_dispatches;      pending_dispatches = g_slist_remove_link (pending_dispatches, pending_dispatches);      g_slist_free_1 (tmp_list);      if (G_HOOK_IS_VALID (source))	{	  gboolean was_in_call;	  gpointer hook_data = source->hook.data;	  gpointer source_data = source->source_data;	  gboolean (*dispatch) (gpointer,				GTimeVal *,				gpointer);	  dispatch = ((GSourceFuncs *) source->hook.func)->dispatch;	  	  was_in_call = G_HOOK_IN_CALL (source);	  source->hook.flags |= G_HOOK_FLAG_IN_CALL;	  G_UNLOCK (main_loop);	  need_destroy = ! dispatch (source_data,				     dispatch_time,				     hook_data);	  G_LOCK (main_loop);	  if (!was_in_call)	    source->hook.flags &= ~G_HOOK_FLAG_IN_CALL;	  	  if (need_destroy && G_HOOK_IS_VALID (source))	    g_hook_destroy_link (&source_list, (GHook *) source);	}      g_hook_unref (&source_list, (GHook*) source);    }}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:44,


示例26: g_source_destroy_func

/* HOLDS: main_loop lock */static voidg_source_destroy_func (GHookList *hook_list,		       GHook     *hook){  GSource *source = (GSource*) hook;  GDestroyNotify destroy;  G_UNLOCK (main_loop);  destroy = hook->destroy;  if (destroy)    destroy (hook->data);  destroy = ((GSourceFuncs*) hook->func)->destroy;  if (destroy)    destroy (source->source_data);  G_LOCK (main_loop);}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:20,


示例27: coordinates_render

static voidcoordinates_render(OsmGpsMapAis *self, OsmGpsMap *map){    OsdCoordinates_t *coordinates = self->priv->coordinates;	OsmGpsMapPoint point;    if(!coordinates->surface)        return;	gfloat lat, lon;	g_object_get(G_OBJECT(map), "latitude", &lat, "longitude", &lon, NULL);	coordinates->lat = lat;	coordinates->lon = lon;	gint pixel_x, pixel_y;    g_assert(coordinates->surface);    cairo_t *cr = cairo_create(coordinates->surface);    cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);    cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0);    cairo_paint(cr);    cairo_set_operator(cr, CAIRO_OPERATOR_OVER);    cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);	cairo_set_line_width(cr, 1);	int i;	float theta;	printf("Number of vessels: %d/n",numberofships);	G_LOCK(updatemap);	for(i=0;i<numberofships;i++) {		osm_gps_map_point_set_degrees(&point, ships[i]->latitude, ships[i]->longitude);		osm_gps_map_convert_geographic_to_screen(map, &point, &pixel_x,&pixel_y);		if (ships[i]->heading != 511)			theta = ships[i]->heading * M_PI / 180;		else			theta = ships[i]->course * M_PI / 180;		draw_one_boat(cr,(int)pixel_x,(int)pixel_y,theta);		printf("%f %f/n",ships[i]->latitude, ships[i]->longitude);	}	G_UNLOCK(updatemap);    cairo_destroy(cr);}
开发者ID:cynsky,项目名称:gnuais,代码行数:43,


示例28: test_g_mutex

static voidtest_g_mutex (void){  GThread *thread;  g_assert (g_mutex_trylock (&test_g_mutex_mutex));  g_assert (G_TRYLOCK (test_g_mutex));  test_g_mutex_thread_ready = FALSE;  thread = g_thread_create (test_g_mutex_thread, GINT_TO_POINTER (42),			    TRUE, NULL);  /* This busy wait is only for testing purposes and not an example of   * good code!*/  while (!test_g_mutex_thread_ready)    g_usleep (G_USEC_PER_SEC / 5);  test_g_mutex_int = 42;  G_UNLOCK (test_g_mutex);  g_mutex_unlock (&test_g_mutex_mutex);  g_assert (GPOINTER_TO_INT (g_thread_join (thread)) == 41);}
开发者ID:492852238,项目名称:SourceLearning,代码行数:19,


示例29: catch_log_handler

/** * catch_log_handler: * @log_domain: A string containing the log section. * @log_level: A #GLogLevelFlags. * @message: The string message. * @user_data: User data supplied to g_log_set_default_handler(). * * Default log handler that will dispatch log messages to configured logging * destinations. */static voidcatch_log_handler (const gchar    *log_domain,                   GLogLevelFlags  log_level,                   const gchar    *message,                   gpointer        user_data){   struct tm tt;   time_t t;   const gchar *level;   gchar ftime[32];   gchar *buffer;   guint msec;   if (G_LIKELY(channels->len)) {      level = catch_log_level_str(log_level);#ifdef __linux__      {         struct timespec ts;         clock_gettime(CLOCK_REALTIME, &ts);         t = (time_t)ts.tv_sec;         msec = ts.tv_nsec / 100000;      }#else      {         struct timeval tv;         gettimeofday(&tv, NULL);         t = tv.tv_sec;         msec = tv.tv_usec / 1000;      }#endif      tt = *localtime(&t);      strftime(ftime, sizeof(ftime), "%Y/%m/%d %H:%M:%S", &tt);      buffer = g_strdup_printf("%s.%04u  %s: %12s[%d]: %8s: %s/n",                               ftime, msec,                               hostname, log_domain,                               catch_log_get_thread(), level, message);      G_LOCK(channels_lock);      g_ptr_array_foreach(channels, (GFunc)catch_log_write_to_channel, buffer);      G_UNLOCK(channels_lock);      g_free(buffer);   }}
开发者ID:chergert,项目名称:catch-glib,代码行数:52,



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


C++ G_UseTargets函数代码示例
C++ G_UNLIKELY函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。