static void rm_directory_free(RmDirectory *self) { rm_digest_free(self->digest); g_hash_table_unref(self->hash_set); g_queue_clear(&self->known_files); g_queue_clear(&self->children); g_free(self->dirname); g_free(self); }
static void __ice_agent_free_components(struct ice_agent *ag) { g_queue_clear(&ag->triggered); g_hash_table_destroy(ag->candidate_hash); g_hash_table_destroy(ag->pair_hash); g_hash_table_destroy(ag->transaction_hash); g_hash_table_destroy(ag->foundation_hash); g_tree_destroy(ag->all_pairs); g_queue_clear(&ag->all_pairs_list); g_tree_destroy(ag->nominated_pairs); g_tree_destroy(ag->succeeded_pairs); g_tree_destroy(ag->valid_pairs); ice_candidates_free(&ag->remote_candidates); ice_candidate_pairs_free(&ag->candidate_pairs); }
void RenderUniverse() { G_LOCK( UNIVERSE_RENDER_BUSY ); { if( buffer_clear_requested ) { if( buffer_clear_last_good ) { // Clear everything in the buffer after buffer_clear_last_good } else { // Clear the entire buffer g_queue_foreach( universe_buffer, Universe_GFuncFree, NULL ); g_queue_clear( universe_buffer ); } buffer_clear_requested = 0; } // Find the last Universe Universe tail = g_queue_peek_tail( universe_buffer ); if( tail == NULL ) { tail = current; } // Clone it Universe temp = Universe_duplicate( tail ); // Perform a tick Universe_performTick( temp ); // Add it to the Universe queue g_queue_push_tail( universe_buffer, temp ); } G_UNLOCK( UNIVERSE_RENDER_BUSY ); }
void StartSimulation( Universe start, double time_tick, double theta ) { // Block the RenderUniverse thread, if it's running G_LOCK( UNIVERSE_RENDER_BUSY ); // If the RenderUniverse thread isn't running, start it up. if( renderUniverseThread == NULL ) { renderUniverseThread = g_thread_create( RenderUniverseDaemonThread, NULL, 0, NULL); } // Clear the universe_buffer if it exists, create it if otherwise if( universe_buffer ) { g_queue_foreach( universe_buffer, Universe_GFuncFree, NULL ); g_queue_clear( universe_buffer ); } else { universe_buffer = g_queue_new(); } // Free the current universe if it exists, then set it to our start Universe_freeUniverse( ¤t ); current = start; // Clear the various global variables buffer_clear_requested = 0; buffer_clear_last_good = NULL; // Set the time_tick and theta globals _time_tick = time_tick; _theta = theta; // Unblock the RenderUniverse thread G_UNLOCK( UNIVERSE_RENDER_BUSY ); }
void my_layer_delete_all_control_shapes (MyLayer *self) { /* GQueue *tmpQ; guint j, len; MyShape *shape; MyLayerPrivate* priv = MY_LAYER_GET_PRIVATE (self); my_debug ("delete all control shapes ..."); tmpQ = g_queue_new(); // 双队列实现删除 g_queue_push_tail (priv->shapes, NULL); while (shape = g_queue_pop_head (priv->shapes)) { my_debug ("loop %u shape %#x", j, shape); if (MY_IS_CONTROL_SHAPE_RECT(shape)) { my_debug ("deleting control shape %#x", shape); } else { g_queue_push_tail (tmpQ, shape); } } g_queue_clear (priv->shapes); priv->shapes = tmpQ; my_debug ("delete all control shapes done."); */ GQueue *tmpQ; MyLayerPrivate* priv = MY_LAYER_GET_PRIVATE (self); my_debug ("deleting all control in shapes queue %#x ...", priv->shapes); my_debug ("deleteData function %#x ...", deleteData); tmpQ = my_util_delete_queue_element (priv->shapes, deleteData, NULL); g_queue_clear (priv->shapes); priv->shapes = tmpQ; my_debug ("after delete shapes count is %d", g_queue_get_length (tmpQ)); my_debug ("deleting all control in shapes queue %#x done.", priv->shapes); }
static void gst_hls_demux_reset (GstHLSDemux * demux, gboolean dispose) { demux->need_cache = TRUE; demux->thread_return = FALSE; demux->accumulated_delay = 0; demux->end_of_playlist = FALSE; demux->cancelled = FALSE; if (demux->input_caps) { gst_caps_unref (demux->input_caps); demux->input_caps = NULL; } if (demux->playlist) { gst_buffer_unref (demux->playlist); demux->playlist = NULL; } gst_adapter_clear (demux->download); if (demux->client) gst_m3u8_client_free (demux->client); if (!dispose) { demux->client = gst_m3u8_client_new (""); } while (!g_queue_is_empty (demux->queue)) { GstBuffer *buf = g_queue_pop_head (demux->queue); gst_buffer_unref (buf); } g_queue_clear (demux->queue); }
static void free_trace_values (GstTraceValues * self) { g_queue_foreach (&self->values, (GFunc) free_trace_value, NULL); g_queue_clear (&self->values); g_slice_free (GstTraceValues, self); }
gboolean intercept_midi_event (gint * midi) { if (divert_midi_event) { infodialog (_("Not exiting the previous MIDI capture loop")); g_warning ("Cannot return to script"); // divert_midi_event = NULL; // return FALSE; set_midi_capture (FALSE); g_queue_clear (&midi_queue); return FALSE; } if (g_queue_is_empty (&midi_queue)) { divert_midi_event = midi; divert_midi_id = Denemo.project->id; set_midi_capture (TRUE); gtk_main (); divert_midi_event = NULL; return TRUE; } else { *midi = (0xFFFFFF & get_midiqueue ()); //g_debug("getting from queue %x\n", *midi); } return TRUE; }
static void gst_dtls_enc_finalize (GObject * object) { GstDtlsEnc *self = GST_DTLS_ENC (object); if (self->encoder_key) { gst_buffer_unref (self->encoder_key); self->encoder_key = NULL; } if (self->connection_id) { g_free (self->connection_id); self->connection_id = NULL; } g_mutex_lock (&self->queue_lock); g_queue_foreach (&self->queue, (GFunc) gst_buffer_unref, NULL); g_queue_clear (&self->queue); g_mutex_unlock (&self->queue_lock); g_mutex_clear (&self->queue_lock); g_cond_clear (&self->queue_cond_add); GST_LOG_OBJECT (self, "finalized"); G_OBJECT_CLASS (parent_class)->finalize (object); }
static void colo_compare_finalize(Object *obj) { CompareState *s = COLO_COMPARE(obj); qemu_chr_fe_deinit(&s->chr_pri_in, false); qemu_chr_fe_deinit(&s->chr_sec_in, false); qemu_chr_fe_deinit(&s->chr_out, false); if (s->iothread) { colo_compare_timer_del(s); } /* Release all unhandled packets after compare thead exited */ g_queue_foreach(&s->conn_list, colo_flush_packets, s); g_queue_clear(&s->conn_list); if (s->connection_track_table) { g_hash_table_destroy(s->connection_track_table); } if (s->iothread) { object_unref(OBJECT(s->iothread)); } g_free(s->pri_indev); g_free(s->sec_indev); g_free(s->outdev); }
static void mq_stream_ctx_free (MqStreamCtx * ctx) { g_queue_foreach (&ctx->queued_bufs, (GFunc) mq_stream_buf_free, NULL); g_queue_clear (&ctx->queued_bufs); g_free (ctx); }
static str *call_update_lookup_udp(char **out, struct callmaster *m, enum call_opmode opmode) { struct call *c; struct call_monologue *monologue; GQueue q = G_QUEUE_INIT; struct stream_params sp; str *ret, callid, viabranch, fromtag, totag = STR_NULL; int i; str_init(&callid, out[RE_UDP_UL_CALLID]); str_init(&viabranch, out[RE_UDP_UL_VIABRANCH]); str_init(&fromtag, out[RE_UDP_UL_FROMTAG]); if (opmode == OP_ANSWER) str_init(&totag, out[RE_UDP_UL_TOTAG]); c = call_get_opmode(&callid, m, opmode); if (!c) { ilog(LOG_WARNING, "["STR_FORMAT"] Got UDP LOOKUP for unknown call-id", STR_FMT(&callid)); return str_sprintf("%s 0 0.0.0.0\n", out[RE_UDP_COOKIE]); } monologue = call_get_mono_dialogue(c, &fromtag, &totag); if (!monologue) goto ml_fail; if (addr_parse_udp(&sp, out)) goto addr_fail; g_queue_push_tail(&q, &sp); i = monologue_offer_answer(monologue, &q, NULL); g_queue_clear(&q); if (i) goto unlock_fail; ret = streams_print(&monologue->active_dialogue->medias, sp.index, sp.index, out[RE_UDP_COOKIE], SAF_UDP); rwlock_unlock_w(&c->master_lock); redis_update(c, m->conf.redis); ilog(LOG_INFO, "Returning to SIP proxy: "STR_FORMAT"", STR_FMT(ret)); goto out; ml_fail: ilog(LOG_ERR, "Invalid dialogue association"); goto unlock_fail; addr_fail: ilog(LOG_ERR, "Failed to parse a media stream: %s/%s:%s", out[RE_UDP_UL_ADDR4], out[RE_UDP_UL_ADDR6], out[RE_UDP_UL_PORT]); goto unlock_fail; unlock_fail: rwlock_unlock_w(&c->master_lock); ret = str_sprintf("%s E8\n", out[RE_UDP_COOKIE]); out: obj_put(c); return ret; }
bool mgmt_cancel_all(struct mgmt *mgmt) { if (!mgmt) return false; g_list_foreach(mgmt->pending_list, destroy_request, NULL); g_list_free(mgmt->pending_list); mgmt->pending_list = NULL; g_queue_foreach(mgmt->reply_queue, destroy_request, NULL); g_queue_clear(mgmt->reply_queue); g_queue_foreach(mgmt->request_queue, destroy_request, NULL); g_queue_clear(mgmt->request_queue); return true; }
void queue_clear(gboolean notif) { queue_stop(FALSE); g_queue_foreach(&g_queue, cb_queue_track_release, NULL); g_queue_clear(&g_queue); g_current_track = -1; if (notif) queue_notify(); }
void my_layer_clear (MyLayer *self) { MyLayerPrivate* priv = MY_LAYER_GET_PRIVATE (self); g_queue_clear (priv->shapes); priv->selectedShape = NULL; my_debug ("clear layer done."); }
static gboolean gst_droidcamsrc_mode_negotiate_pad (GstDroidCamSrcMode * mode, GstPad * pad, gboolean force) { GstDroidCamSrcPad *data = gst_pad_get_element_private (pad); /* take pad lock */ g_mutex_lock (&data->lock); if (!force) { if (!gst_pad_check_reconfigure (data->pad)) { g_mutex_unlock (&data->lock); return TRUE; } } /* * stream start * we must send it before we send our CAPS event */ if (G_UNLIKELY (data->open_stream)) { gchar *stream_id; GstEvent *event; stream_id = gst_pad_create_stream_id (data->pad, GST_ELEMENT_CAST (mode->src), GST_PAD_NAME (data->pad)); GST_DEBUG_OBJECT (pad, "Pushing STREAM_START for pad"); event = gst_event_new_stream_start (stream_id); gst_event_set_group_id (event, gst_util_group_id_next ()); if (!gst_pad_push_event (data->pad, event)) { GST_ERROR_OBJECT (mode->src, "failed to push STREAM_START event for pad %s", GST_PAD_NAME (data->pad)); } g_free (stream_id); data->open_stream = FALSE; } /* negotiate */ if (!data->negotiate (data)) { GST_ELEMENT_ERROR (mode->src, STREAM, FORMAT, (NULL), ("failed to negotiate %s.", GST_PAD_NAME (data->pad))); g_mutex_unlock (&data->lock); return FALSE; } /* toss pad queue */ g_queue_foreach (data->queue, (GFunc) gst_buffer_unref, NULL); g_queue_clear (data->queue); /* unlock */ g_mutex_unlock (&data->lock); return TRUE; }
void fm_list_unref(FmList* list) { if(g_atomic_int_dec_and_test(&list->n_ref)) { g_queue_foreach((GQueue*)list, (GFunc)list->funcs->item_unref, NULL); g_queue_clear((GQueue*)list); g_slice_free(FmList, list); } }
void gst_vaapi_video_pool_finalize (GstVaapiVideoPool * pool) { g_list_free_full (pool->used_objects, gst_vaapi_object_unref); g_queue_foreach (&pool->free_objects, (GFunc) gst_vaapi_object_unref, NULL); g_queue_clear (&pool->free_objects); gst_vaapi_display_replace (&pool->display, NULL); g_mutex_clear (&pool->mutex); }
void tracker_priority_queue_unref (TrackerPriorityQueue *queue) { if (g_atomic_int_dec_and_test (&queue->ref_count)) { g_queue_clear (&queue->queue); g_array_free (queue->segments, TRUE); g_slice_free (TrackerPriorityQueue, queue); } }
static void gst_sctp_enc_finalize(GObject *object) { GstSctpEnc *self = GST_SCTP_ENC(object); g_queue_clear(&self->pending_pads); gst_object_unref(self->outbound_sctp_packet_queue); G_OBJECT_CLASS(parent_class)->finalize (object); }
void vis_runner_flush (void) { g_free (current_node); current_node = NULL; g_queue_foreach (& vis_list, (GFunc) g_free, NULL); g_queue_clear (& vis_list); clear_source = g_timeout_add (0, send_clear, NULL); }
static void tp_chat_dispose (GObject *object) { EmpathyTpChat *self = EMPATHY_TP_CHAT (object); EmpathyTpChatPriv *priv = GET_PRIV (self); if (priv->dispose_has_run) return; priv->dispose_has_run = TRUE; if (priv->channel != NULL) { g_signal_handlers_disconnect_by_func (priv->channel, tp_chat_invalidated_cb, self); g_object_unref (priv->channel); } priv->channel = NULL; if (priv->remote_contact != NULL) g_object_unref (priv->remote_contact); priv->remote_contact = NULL; if (priv->factory != NULL) g_object_unref (priv->factory); priv->factory = NULL; if (priv->user != NULL) g_object_unref (priv->user); priv->user = NULL; if (priv->contact_monitor) g_object_unref (priv->contact_monitor); priv->contact_monitor = NULL; g_queue_foreach (priv->messages_queue, (GFunc) g_object_unref, NULL); g_queue_clear (priv->messages_queue); g_queue_foreach (priv->pending_messages_queue, (GFunc) g_object_unref, NULL); g_queue_clear (priv->pending_messages_queue); if (G_OBJECT_CLASS (empathy_tp_chat_parent_class)->dispose) G_OBJECT_CLASS (empathy_tp_chat_parent_class)->dispose (object); }
static void free_undo_queue ( void ) { GpUndo *undo; while ( ( undo = g_queue_pop_head ( undo_queue ) ) != NULL ) { undo_free ( undo ); } g_queue_clear (undo_queue); }
/** * g_queue_clear_full: * @queue: a pointer to a #GQueue * @free_func: (nullable): the function to be called to free memory allocated * * Convenience method, which frees all the memory used by a #GQueue, * and calls the provided @free_func on each item in the #GQueue. * * Since: 2.60 */ void g_queue_clear_full (GQueue * queue, GDestroyNotify free_func) { g_return_if_fail (queue != NULL); if (free_func != NULL) g_queue_foreach (queue, (GFunc) free_func, NULL); g_queue_clear (queue); }
/** * champlain_memory_cache_clean: * @memory_cache: a #ChamplainMemoryCache * * Cleans the contents of the cache. * * Since: 0.8 */ void champlain_memory_cache_clean (ChamplainMemoryCache *memory_cache) { ChamplainMemoryCachePrivate *priv = memory_cache->priv; g_queue_foreach (priv->queue, (GFunc) delete_queue_member, NULL); g_queue_clear (priv->queue); g_hash_table_destroy (memory_cache->priv->hash_table); priv->hash_table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); }
void gst_droidcamsrc_dev_stop_video_recording (GstDroidCamSrcDev * dev) { GST_DEBUG ("dev stop video recording"); gst_buffer_pool_set_flushing (dev->pool, TRUE); /* We need to make sure that some buffers have been pushed */ g_mutex_lock (&dev->vid->lock); while (dev->vid->video_frames <= 4) { g_cond_wait (&dev->vid->cond, &dev->vid->lock); } g_mutex_unlock (&dev->vid->lock); /* Now stop pushing to the pad */ g_rec_mutex_lock (dev->lock); dev->vid->running = FALSE; g_rec_mutex_unlock (dev->lock); /* now make sure nothing is being pushed to the queue */ g_mutex_lock (&dev->vid->lock); g_mutex_unlock (&dev->vid->lock); /* our pad task is either sleeping or still pushing buffers. We empty the queue. */ g_mutex_lock (&dev->vidsrc->lock); g_queue_foreach (dev->vidsrc->queue, (GFunc) gst_buffer_unref, NULL); g_queue_clear (dev->vidsrc->queue); g_mutex_unlock (&dev->vidsrc->lock); /* now we are done. We just push eos */ GST_DEBUG ("Pushing EOS"); if (!gst_pad_push_event (dev->vidsrc->pad, gst_event_new_eos ())) { GST_ERROR ("failed to push EOS event"); } g_rec_mutex_lock (dev->lock); GST_INFO ("waiting for queued frames %i", dev->vid->queued_frames); while (dev->vid->queued_frames > 0) { GST_INFO ("waiting for queued frames to reach 0 from %i", dev->vid->queued_frames); g_rec_mutex_unlock (dev->lock); usleep (VIDEO_RECORDING_STOP_TIMEOUT); g_rec_mutex_lock (dev->lock); } g_rec_mutex_unlock (dev->lock); droid_media_camera_stop_recording (dev->cam); gst_buffer_pool_set_flushing (dev->pool, FALSE); GST_INFO ("dev stopped video recording"); }
static void hrt_task_runner_finalize(GObject *object) { HrtTaskRunner *runner; runner = HRT_TASK_RUNNER(object); /* the completed tasks idle has to complete before we can * finalize. */ g_assert(g_queue_get_length(&runner->completed_tasks) == 0); g_assert(runner->completed_tasks_idle_id == 0); g_queue_clear(&runner->completed_tasks); g_mutex_free(runner->completed_tasks_lock); /* the idle should have cleared this too. */ g_assert(g_queue_get_length(&runner->unlocked_completed_tasks) == 0); g_queue_clear(&runner->unlocked_completed_tasks); G_OBJECT_CLASS(hrt_task_runner_parent_class)->finalize(object); }
void p2tr_cluster_free (P2trCluster *self) { GList *iter; for (iter = g_queue_peek_head(&self->edges); iter != NULL; iter = iter->next) p2tr_edge_unref ((P2trEdge*)iter->data); g_queue_clear (&self->edges); g_slice_free (P2trCluster, self); }
/* call(W) or call(R)+agent must be locked - no in_lock or out_lock must be held */ static int __check_valid(struct ice_agent *ag) { struct call_media *media = ag->media; struct packet_stream *ps; GList *l, *k, *m; GQueue all_compos; struct ice_candidate_pair *pair; // const struct local_intf *ifa; struct stream_fd *sfd; if (!ag) { ilog(LOG_ERR, "ice ag is NULL"); return 0; } __get_complete_valid_pairs(&all_compos, ag); if (!all_compos.length) { ilog(LOG_DEBUG, "ICE not completed yet"); return 0; } pair = all_compos.head->data; ilog(LOG_DEBUG, "ICE completed, using pair "PAIR_FORMAT, PAIR_FMT(pair)); AGENT_SET(ag, COMPLETED); for (l = media->streams.head, k = all_compos.head; l && k; l = l->next, k = k->next) { ps = l->data; pair = k->data; mutex_lock(&ps->out_lock); if (memcmp(&ps->endpoint, &pair->remote_candidate->endpoint, sizeof(ps->endpoint))) { ilog(LOG_INFO, "ICE negotiated: peer for component %u is %s", ps->component, endpoint_print_buf(&pair->remote_candidate->endpoint)); ps->endpoint = pair->remote_candidate->endpoint; } mutex_unlock(&ps->out_lock); for (m = ps->sfds.head; m; m = m->next) { sfd = m->data; if (sfd->local_intf != pair->local_intf) continue; ps->selected_sfd = sfd; if (ps->component == 1) ilog(LOG_INFO, "ICE negotiated: local interface %s", sockaddr_print_buf(&pair->local_intf->spec->local_address.addr)); } } call_media_unkernelize(media); g_queue_clear(&all_compos); return 1; }
static void purge_message_queue (GdmSmartcardExtension *extension) { if (extension->priv->message_timeout_id) { g_source_remove (extension->priv->message_timeout_id); extension->priv->message_timeout_id = 0; } g_queue_foreach (extension->priv->message_queue, (GFunc) free_queued_message, NULL); g_queue_clear (extension->priv->message_queue); }