static void dispatcher_finalize(GObject *object) { Dispatcher *self = DISPATCHER(object); g_free(self->priv->messages); close(self->priv->send_fd); close(self->priv->recv_fd); pthread_mutex_destroy(&self->priv->lock); free(self->priv->payload); G_OBJECT_CLASS(dispatcher_parent_class)->finalize(object); }
/** * facq_window_fun: * @n_samples: The desired number of points in the returned vector. * @type: The type of window function to return, see #FacqWindowFunType for * available types. * * Computes @n_samples of the window function determined by @type, and creates a * vector containing the computed samples. * * Returns: A real vector, you must free it with g_free(). */ gdouble *facq_window_fun(gsize n_samples,FacqWindowFunType type) { gdouble *ret = NULL; guint i = 0; ret = g_malloc0_n(n_samples,sizeof(gdouble)); for(i = 0;i < n_samples;i++) DISPATCHER(ret[i],i,n_samples,type); return ret; }
static void dispatcher_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { Dispatcher *self = DISPATCHER(object); switch (property_id) { case PROP_MAX_MESSAGE_TYPE: self->priv->max_message_type = g_value_get_uint(value); break; case PROP_OPAQUE: dispatcher_set_opaque(self, g_value_get_pointer(value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec); } }
static void dispatcher_constructed(GObject *object) { Dispatcher *self = DISPATCHER(object); int channels[2]; G_OBJECT_CLASS(dispatcher_parent_class)->constructed(object); #ifdef DEBUG_DISPATCHER setup_dummy_signal_handler(); #endif if (socketpair(AF_LOCAL, SOCK_STREAM, 0, channels) == -1) { spice_error("socketpair failed %s", strerror(errno)); return; } pthread_mutex_init(&self->priv->lock, NULL); self->priv->recv_fd = channels[0]; self->priv->send_fd = channels[1]; self->priv->self = pthread_self(); self->priv->messages = g_new0(DispatcherMessage, self->priv->max_message_type); }
int existe_aresta(const Grafo *grafo, int u, int v) { DISPATCHER(existe_aresta, 0, u, v); }