コード例 #1
0
ファイル: vulcano.c プロジェクト: StrumentiResistenti/MagmaFS
/**
 * Destroy a magma_volcano structure
 *
 * @param node the magma_volcano structure to destroy
 */
int magma_vulcano_destroy(magma_volcano *node)
{
	if (node == NULL) return 1;

	/* re-link the net */
	// magma_lock_node(node);
	if (node->prev) node->prev->next = node->next;
	if (node->next) node->next->prev = node->prev;
	// magma_unlock_node(node);

	if (lava->first_node == node) {
		lava->first_node = node->next;
	} else if (lava->last_node == node) {
		lava->last_node = node->prev;
	}

	/* free resources */
#if MAGMA_ENABLE_NODE_LOCKING
	g_rec_mutex_clear(&(node->mutex));
#endif

	g_free(node);

	/* return */
	return (1);
}
コード例 #2
0
ファイル: gda-web-util.c プロジェクト: arthurnn/libgda
/*
 * Free connection's specific data
 */
void
_gda_web_free_cnc_data (WebConnectionData *cdata)
{
	if (!cdata)
		return;

	if (cdata->reuseable) {
		g_assert (cdata->reuseable->operations);
		if (cdata->reuseable->operations->re_reset_data)
			cdata->reuseable->operations->re_reset_data (cdata->reuseable);
		g_free (cdata->reuseable);
	}
	g_free (cdata->server_id);
	g_free (cdata->server_version);
	g_free (cdata->server_base_url);
	g_free (cdata->front_url);
	g_free (cdata->worker_url);
	g_rec_mutex_clear (& (cdata->mutex));
	if (cdata->worker_session)
		g_object_unref (cdata->worker_session);
	if (cdata->front_session)
		g_object_unref (cdata->front_session);
	g_free (cdata->session_id);
	g_free (cdata->server_secret);
	g_free (cdata->key);
	g_free (cdata->next_challenge);

	g_free (cdata);
}
コード例 #3
0
ファイル: gda-pstmt.c プロジェクト: GNOME/libgda
static void
gda_pstmt_dispose (GObject *object)
{
	GdaPStmt *pstmt = (GdaPStmt *) object;
	GdaPStmtPrivate *priv = gda_pstmt_get_instance_private (pstmt);

	gda_stmt_reset_cb (NULL, pstmt);

	/* free memory */
	g_rec_mutex_clear (& priv->mutex);
	g_weak_ref_clear (&priv->gda_stmt_ref);

	if (priv->sql != NULL) {
		g_free (priv->sql);
		priv->sql = NULL;
	}
	if (priv->param_ids != NULL) {
		g_slist_free_full (priv->param_ids, (GDestroyNotify) g_free);
		priv->param_ids = NULL;
	}
	if (priv->types != NULL) {
		g_free (priv->types);
		priv->types = NULL;
	}
	if (priv->tmpl_columns != NULL) {
		g_slist_free_full (priv->tmpl_columns, (GDestroyNotify) g_object_unref);
		priv->tmpl_columns = NULL;
	}

	/* chain to parent class */
	G_OBJECT_CLASS (gda_pstmt_parent_class)->dispose (object);
}
コード例 #4
0
void
gst_decklink_src_finalize (GObject * object)
{
  GstDecklinkSrc *decklinksrc;

  g_return_if_fail (GST_IS_DECKLINK_SRC (object));
  decklinksrc = GST_DECKLINK_SRC (object);

  /* clean up object here */

  g_cond_clear (&decklinksrc->cond);
  g_mutex_clear (&decklinksrc->mutex);
  gst_task_set_lock (decklinksrc->task, NULL);
  g_object_unref (decklinksrc->task);

#ifdef _MSC_VER
  /* signal the COM thread that it should uninitialize COM */
  if (decklinksrc->comInitialized) {
    g_mutex_lock (&decklinksrc->com_deinit_lock);
    g_cond_signal (&decklinksrc->com_uninitialize);
    g_cond_wait (&decklinksrc->com_uninitialized, &decklinksrc->com_deinit_lock);
    g_mutex_unlock (&decklinksrc->com_deinit_lock);
  }

  g_mutex_clear (&decklinksrc->com_init_lock);
  g_mutex_clear (&decklinksrc->com_deinit_lock);
  g_cond_clear (&decklinksrc->com_initialized);
  g_cond_clear (&decklinksrc->com_uninitialize);
  g_cond_clear (&decklinksrc->com_uninitialized);
#endif /* _MSC_VER */

  g_rec_mutex_clear (&decklinksrc->task_mutex);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
コード例 #5
0
ファイル: gda-pstmt.c プロジェクト: arthurnn/libgda
static void
gda_pstmt_finalize (GObject *object)
{
	GdaPStmt *pstmt = (GdaPStmt *) object;

	/* free memory */
	g_weak_ref_clear (& pstmt->priv->gda_stmt_ref);
	g_rec_mutex_clear (& pstmt->priv->mutex);
	g_free (pstmt->priv);

	if (pstmt->sql) {
		g_free (pstmt->sql);
		pstmt->sql = NULL;
	}
	if (pstmt->param_ids) {
		g_slist_foreach (pstmt->param_ids, (GFunc) g_free, NULL);
		g_slist_free (pstmt->param_ids);
		pstmt->param_ids = NULL;
	}
	if (pstmt->types) {
		g_free (pstmt->types);
		pstmt->types = NULL;
	}
	if (pstmt->tmpl_columns) {
		g_slist_foreach (pstmt->tmpl_columns, (GFunc) g_object_unref, NULL);
		g_slist_free (pstmt->tmpl_columns);
	}

	/* chain to parent class */
	parent_class->finalize (object);
}
コード例 #6
0
ファイル: Joint.c プロジェクト: frmdstryr/pysoy-ping-pong
static void _vala_clear_GRecMutex (GRecMutex * mutex) {
	GRecMutex zero_mutex = { 0 };
	if (memcmp (mutex, &zero_mutex, sizeof (GRecMutex))) {
		g_rec_mutex_clear (mutex);
		memset (mutex, 0, sizeof (GRecMutex));
	}
}
コード例 #7
0
ファイル: core.c プロジェクト: heirecka/lgi
/* GC method for GRecMutex structure, which lives inside lua_State. */
static int
call_mutex_gc (lua_State* L)
{
  LgiStateMutex *mutex = lua_touserdata (L, 1);
  g_rec_mutex_unlock (mutex->mutex);
  g_rec_mutex_clear (&mutex->state_mutex);
  return 0;
}
コード例 #8
0
/**
 * e_cancellable_rec_mutex_clear:
 * @rec_mutex: an #ECancellableRecMutex instance
 *
 * Frees memory allocated by e_cancellable_rec_mutex_init().
 *
 * Since: 3.8
 **/
void
e_cancellable_rec_mutex_clear (ECancellableRecMutex *rec_mutex)
{
	g_return_if_fail (rec_mutex != NULL);

	g_rec_mutex_clear (&rec_mutex->rec_mutex);
	g_mutex_clear (&rec_mutex->base.cond_mutex);
	g_cond_clear (&rec_mutex->base.cond);
}
コード例 #9
0
void
e_mapi_cancellable_rec_mutex_clear (EMapiCancellableRecMutex *rec_mutex)
{
	g_return_if_fail (rec_mutex != NULL);

	g_rec_mutex_clear (&rec_mutex->rec_mutex);
	g_mutex_clear (&rec_mutex->cond_mutex);
	g_cond_clear (&rec_mutex->cond);
}
コード例 #10
0
static void
kms_base_mixer_finalize (GObject * object)
{
  KmsBaseMixer *self = KMS_BASE_MIXER (object);

  g_rec_mutex_clear (&self->priv->mutex);

  G_OBJECT_CLASS (kms_base_mixer_parent_class)->finalize (object);
}
コード例 #11
0
static void
goa_alarm_finalize (GObject *object)
{
  GoaAlarm *self = GOA_ALARM (object);

  g_rec_mutex_clear (&self->priv->lock);

  G_OBJECT_CLASS (goa_alarm_parent_class)->finalize (object);
}
コード例 #12
0
static void
kms_dispatcher_finalize (GObject * object)
{
  KmsDispatcher *self = KMS_DISPATCHER (object);

  GST_DEBUG_OBJECT (self, "finalize");

  G_OBJECT_CLASS (kms_dispatcher_parent_class)->finalize (object);
  g_rec_mutex_clear (&self->priv->mutex);
}
コード例 #13
0
static void
gst_rtp_ssrc_demux_finalize (GObject * object)
{
    GstRtpSsrcDemux *demux;

    demux = GST_RTP_SSRC_DEMUX (object);
    g_rec_mutex_clear (&demux->padlock);

    G_OBJECT_CLASS (parent_class)->finalize (object);
}
コード例 #14
0
static void
kms_connect_data_destroy (KmsConnectData * data)
{
  g_free (data->audio_src);
  g_free (data->video_src);
  g_free (data->data_src);

  g_rec_mutex_clear (&data->mutex);

  g_slice_free (KmsConnectData, data);
}
コード例 #15
0
static void
kms_element_finalize (GObject * object)
{
  KmsElement *element = KMS_ELEMENT (object);

  /* free resources allocated by this object */
  g_rec_mutex_clear (&element->mutex);

  /* chain up */
  G_OBJECT_CLASS (kms_element_parent_class)->finalize (object);
}
コード例 #16
0
ファイル: kmsremb.c プロジェクト: theravengod/kms-core
static void
kms_remb_base_destroy (KmsRembBase * rb)
{
  g_signal_handler_disconnect (rb->rtpsess, rb->signal_id);
  rb->signal_id = 0;
  g_object_set_data (rb->rtpsess, KMS_REMB_LOCAL, NULL);
  g_object_set_data (rb->rtpsess, KMS_REMB_REMOTE, NULL);
  g_clear_object (&rb->rtpsess);
  g_rec_mutex_clear (&rb->mutex);
  g_hash_table_unref (rb->remb_stats);
}
コード例 #17
0
static void
kms_selectable_mixer_finalize (GObject * object)
{
  KmsSelectableMixer *self = KMS_SELECTABLE_MIXER (object);

  GST_DEBUG_OBJECT (self, "finalize");

  g_rec_mutex_clear (&self->priv->mutex);

  G_OBJECT_CLASS (kms_selectable_mixer_parent_class)->finalize (object);
}
コード例 #18
0
static void
gst_sctp_base_sink_finalize (GObject * gobject)
{
  GstSCTPBaseSink *self = GST_SCTP_BASE_SINK (gobject);

  g_free (self->priv->host);
  self->priv->host = NULL;

  g_rec_mutex_clear (&self->priv->mutex);

  G_OBJECT_CLASS (gst_sctp_base_sink_parent_class)->finalize (gobject);
}
コード例 #19
0
static void
kms_rtp_synchronizer_finalize (GObject * object)
{
  KmsRtpSynchronizer *self = KMS_RTP_SYNCHRONIZER (object);

  GST_DEBUG_OBJECT (self, "finalize");

  g_object_unref (self->priv->context);
  g_rec_mutex_clear (&self->priv->mutex);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
コード例 #20
0
ファイル: kmsaudiomixer.c プロジェクト: KennyDark/kms-core
static void
kms_audio_mixer_finalize (GObject * object)
{
  KmsAudioMixer *self = KMS_AUDIO_MIXER (object);

  GST_DEBUG_OBJECT (self, "finalize");

  g_hash_table_unref (self->priv->typefinds);
  g_rec_mutex_clear (&self->priv->mutex);

  G_OBJECT_CLASS (kms_audio_mixer_parent_class)->finalize (object);
}
コード例 #21
0
/**
 * g_static_rec_mutex_free:
 * @mutex: a #GStaticRecMutex to be freed.
 *
 * Releases all resources allocated to a #GStaticRecMutex.
 *
 * You don't have to call this functions for a #GStaticRecMutex with an
 * unbounded lifetime, i.e. objects declared 'static', but if you have
 * a #GStaticRecMutex as a member of a structure and the structure is
 * freed, you should also free the #GStaticRecMutex.
 *
 * Deprecated: 2.32: Use g_rec_mutex_clear()
 */
void
g_static_rec_mutex_free (GStaticRecMutex *mutex)
{
  g_return_if_fail (mutex);

  if (mutex->mutex.mutex)
    {
      GRecMutex *rm = (GRecMutex *) mutex->mutex.mutex;

      g_rec_mutex_clear (rm);
      g_slice_free (GRecMutex, rm);
    }
}
コード例 #22
0
static void
gst_hls_demux_dispose (GObject * obj)
{
  GstHLSDemux *demux = GST_HLS_DEMUX (obj);

  if (demux->stream_task) {
    if (GST_TASK_STATE (demux->stream_task) != GST_TASK_STOPPED) {
      GST_DEBUG_OBJECT (demux, "Leaving streaming task");
      gst_task_stop (demux->stream_task);
      gst_task_join (demux->stream_task);
    }
    gst_object_unref (demux->stream_task);
    g_rec_mutex_clear (&demux->stream_lock);
    demux->stream_task = NULL;
  }

  if (demux->updates_task) {
    if (GST_TASK_STATE (demux->updates_task) != GST_TASK_STOPPED) {
      GST_DEBUG_OBJECT (demux, "Leaving updates task");
      gst_task_stop (demux->updates_task);
      gst_task_join (demux->updates_task);
    }
    gst_object_unref (demux->updates_task);
    g_mutex_clear (&demux->updates_timed_lock);
    g_rec_mutex_clear (&demux->updates_lock);
    demux->updates_task = NULL;
  }

  if (demux->downloader != NULL) {
    g_object_unref (demux->downloader);
    demux->downloader = NULL;
  }

  gst_hls_demux_reset (demux, TRUE);

  g_queue_free (demux->queue);

  G_OBJECT_CLASS (parent_class)->dispose (obj);
}
コード例 #23
0
static void
gst_vaapi_display_cache_finalize (GstVaapiDisplayCache * cache)
{
  GList *l;

  if (cache->list) {
    for (l = cache->list; l != NULL; l = l->next)
      cache_entry_free (l->data);
    g_list_free (cache->list);
    cache->list = NULL;
  }
  g_rec_mutex_clear (&cache->mutex);
}
コード例 #24
0
ファイル: vulcano.c プロジェクト: StrumentiResistenti/MagmaFS
/**
 * Save a node profile into a magma_volcano structure
 *
 * @param node the destination magma_volcano structure
 * @param node_name the node nick name
 * @param fqdn_name the node fully qualified domain name
 * @param ipaddr the IP address as a string
 * @param ipport the IP port as a number
 * @param bandwidth the node available bandwidth in KB/s
 * @param storage the node available storage in MBytes
 * @return the magma_volcano structure filled with provided configuration
 */
magma_volcano *magma_volcano_fill(magma_volcano *node, char *node_name,
	char *fqdn_name, char *ipaddr, int ipport, int bandwidth, int storage,
	char *start_key, char *stop_key, const gchar *dht_path)
{
#if MAGMA_ENABLE_NODE_LOCKING
	/* init node mutex */
	g_rec_mutex_init(&(node->mutex));
#endif

	/* copy node IP address (as string) and perform binary translation (inet_aton) */
	if (ipaddr) {
		if ( ! inet_aton(ipaddr, &node->inaddr) ) {
			dbg(LOG_ERR, DEBUG_ERR, "magma_create_node: IP address not valid!");
#if MAGMA_ENABLE_NODE_LOCKING
			g_rec_mutex_clear(&(node->mutex));
#endif
			g_free(node);
			return NULL;
		}
		g_strlcpy(node->ip_addr, ipaddr, MAX_IP_LENGTH);
	}

	node->port = ipport;
	node->bandwidth = bandwidth;
	node->storage = storage;
	node->load = 0;

	/* copy node nick name */
	if (node_name) g_strlcpy(node->node_name, node_name, MAX_HOSTNAME_LENGTH);

	/* copy fully qualified name */
	if (fqdn_name) g_strlcpy(node->fqdn_name, fqdn_name, MAX_HOSTNAME_LENGTH);

	/* set node default keyspace */
	g_strlcpy(
		node->start_key,
		start_key ? start_key : "0000000000000000000000000000000000000000",
		SHA_READABLE_DIGEST_LENGTH);

	g_strlcpy(
		node->stop_key,
		stop_key ? stop_key : "ffffffffffffffffffffffffffffffffffffffff",
		SHA_READABLE_DIGEST_LENGTH);

	node->prev = NULL;
	node->next = NULL;

	if (dht_path) g_strlcpy(node->hashpath, dht_path, MAX_PATH_LENGTH);

	return (node);
}
コード例 #25
0
static void
gst_sdp_demux_finalize (GObject * object)
{
  GstSDPDemux *demux;

  demux = GST_SDP_DEMUX (object);

  /* free locks */
  g_rec_mutex_clear (&demux->stream_rec_lock);

  g_object_unref (demux->adapter);

  G_OBJECT_CLASS (parent_class)->finalize (object);
}
コード例 #26
0
static void
kms_alpha_blending_finalize (GObject * object)
{
  KmsAlphaBlending *self = KMS_ALPHA_BLENDING (object);

  g_rec_mutex_clear (&self->priv->mutex);

  if (self->priv->ports != NULL) {
    g_hash_table_unref (self->priv->ports);
    self->priv->ports = NULL;
  }

  G_OBJECT_CLASS (kms_alpha_blending_parent_class)->finalize (object);
}
コード例 #27
0
ファイル: gda-worker.c プロジェクト: zzeroo/libgda
/**
 * gda_worker_new: (skip)
 *
 * Creates a new #GdaWorker object.
 *
 * Returns: (transfer full): a new #GdaWorker, or %NULL if an error occurred
 *
 * Since: 6.0
 */
GdaWorker *
gda_worker_new (void)
{
	GdaWorker *worker;
	worker = bg_get_spare_gda_worker ();
	if (worker)
		return worker;

	worker = g_slice_new0 (GdaWorker);
	worker->submit_its = itsignaler_new ();
	if (!worker->submit_its) {
		g_slice_free (GdaWorker, worker);
		return NULL;
	}

	worker->ref_count = 1;

	worker->callbacks_hash = g_hash_table_new_full (NULL, NULL, NULL,
							(GDestroyNotify) declared_callback_free);
	worker->jobs_hash = g_hash_table_new_full (g_int_hash, g_int_equal, NULL, (GDestroyNotify) worker_job_free);

	worker->worker_must_quit = 0;
	worker->location = NULL;

	g_rec_mutex_init (& worker->rmutex);

	gchar *str;
	static guint counter = 0;
	str = g_strdup_printf ("gdaWrkrTh%u", counter);
	counter++;
	worker->worker_thread = g_thread_try_new (str, (GThreadFunc) worker_thread_main, worker, NULL);
	g_free (str);
	if (!worker->worker_thread) {
		itsignaler_unref (worker->submit_its);
		g_hash_table_destroy (worker->callbacks_hash);
		g_hash_table_destroy (worker->jobs_hash);
		g_rec_mutex_clear (& worker->rmutex);
		g_slice_free (GdaWorker, worker);
		return NULL;
	}
	else
		bg_update_stats (BG_STARTED_THREADS);

#ifdef DEBUG_NOTIFICATION
	g_print ("[W] created GdaWorker %p\n", worker);
#endif

	bg_update_stats (BG_CREATED_WORKER);
	return worker;
}
コード例 #28
0
ファイル: kmsagnosticbin.c プロジェクト: shelsonjava/kms-core
static void
kms_agnostic_bin2_finalize (GObject * object)
{
  KmsAgnosticBin2 *self = KMS_AGNOSTIC_BIN2 (object);

  GST_DEBUG_OBJECT (object, "finalize");

  g_rec_mutex_clear (&self->priv->thread_mutex);

  g_hash_table_unref (self->priv->bins);

  /* chain up */
  G_OBJECT_CLASS (kms_agnostic_bin2_parent_class)->finalize (object);
}
コード例 #29
0
static void
kms_composite_mixer_finalize (GObject * object)
{
  KmsCompositeMixer *self = KMS_COMPOSITE_MIXER (object);

  g_rec_mutex_clear (&self->priv->mutex);

  if (self->priv->ports != NULL) {
    g_hash_table_unref (self->priv->ports);
    self->priv->ports = NULL;
  }

  G_OBJECT_CLASS (kms_composite_mixer_parent_class)->finalize (object);
}
コード例 #30
0
static void
kms_webrtc_base_connection_finalize (GObject * object)
{
  KmsWebRtcBaseConnection *self = KMS_WEBRTC_BASE_CONNECTION (object);

  GST_DEBUG_OBJECT (self, "finalize");

  nice_agent_remove_stream (self->agent, self->stream_id);
  g_free (self->name);
  g_clear_object (&self->agent);
  g_rec_mutex_clear (&self->mutex);

  /* chain up */
  G_OBJECT_CLASS (kms_webrtc_base_connection_parent_class)->finalize (object);
}