static void remove_timeout(DBusTimeout *timeout, void *data) { struct wpas_dbus_priv *priv = data; eloop_cancel_timeout(process_timeout, priv, timeout); dbus_timeout_set_data(timeout, NULL, NULL); }
static dbus_bool_t add_timeout(DBusTimeout *dbus_timeout, void *userdata) { TimeoutData *timeout; ConnectionData *d = userdata; struct timeval tv; dbus_bool_t b; assert(dbus_timeout); assert(d); if (!(timeout = avahi_new(TimeoutData, 1))) return FALSE; timeout->dbus_timeout = dbus_timeout; timeout->poll_api = d->poll_api; timeout->ref = 1; if ((b = dbus_timeout_get_enabled(dbus_timeout))) avahi_elapse_time(&tv, dbus_timeout_get_interval(dbus_timeout), 0); if (!(timeout->avahi_timeout = d->poll_api->timeout_new( d->poll_api, b ? &tv : NULL, timeout_callback, timeout))) { avahi_free(timeout); return FALSE; } dbus_timeout_set_data(dbus_timeout, timeout, (DBusFreeFunction) timeout_data_unref); return TRUE; }
static void timeout_handler_source_finalized (gpointer data) { TimeoutHandler *handler = data; if (handler->timeout) dbus_timeout_set_data (handler->timeout, NULL, NULL); g_free (handler); }
dbus_bool_t DBus_AddTimeout(DBusTimeout *timeout, void *data) { Tcl_TimerToken token; token = Tcl_CreateTimerHandler(dbus_timeout_get_interval(timeout), DBus_Timeout, timeout); dbus_timeout_set_data(timeout, token, NULL); return TRUE; }
static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data){ /* add expiration data to timeout */ struct timeval *expires = dbus_malloc(sizeof(struct timeval)); if (!expires) return FALSE; dbus_timeout_set_data(timeout, expires, dbus_free); asdbus_set_dbus_timer (expires, timeout); return TRUE; }
static dbus_bool_t pcmk_dbus_timeout_add(DBusTimeout *timeout, void *data){ guint id = g_timeout_add(dbus_timeout_get_interval(timeout), pcmk_dbus_timeout_dispatch, timeout); crm_trace("Adding timeout %p (%ld)", timeout, dbus_timeout_get_interval(timeout)); if(id) { dbus_timeout_set_data(timeout, GUINT_TO_POINTER(id), NULL); } return TRUE; }
static void connection_setup_add_timeout(struct ctrl_iface_dbus_priv *iface, DBusTimeout *timeout) { if (!dbus_timeout_get_enabled(timeout)) return; eloop_register_timeout(0, dbus_timeout_get_interval(timeout) * 1000, process_timeout, iface, timeout); dbus_timeout_set_data(timeout, iface, NULL); }
/** * Callback for adding D-Bus timeout. */ static dbus_bool_t cdbus_callback_add_timeout(DBusTimeout *timeout, void *data) { session_t *ps = data; timeout_t *ptmout = timeout_insert(ps, dbus_timeout_get_interval(timeout), cdbus_callback_handle_timeout, timeout); if (ptmout) dbus_timeout_set_data(timeout, ptmout, NULL); return (bool) ptmout; }
static void pcmk_dbus_timeout_remove(DBusTimeout *timeout, void *data){ void *vid = dbus_timeout_get_data(timeout); guint id = GPOINTER_TO_UINT(vid); crm_trace("Removing timeout %p (%p)", timeout, data); if(id) { g_source_remove(id); dbus_timeout_set_data(timeout, 0, NULL); } }
static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { struct wpas_dbus_priv *priv = data; if (!dbus_timeout_get_enabled(timeout)) return TRUE; eloop_register_timeout(0, dbus_timeout_get_interval(timeout) * 1000, process_timeout, priv, timeout); dbus_timeout_set_data(timeout, priv, NULL); return TRUE; }
dbus_bool_t timeout_add( DBusTimeout *timeout, void *data ) { int esi; /* phantom */ TimeoutHandler *handler; if ( dbus_timeout_get_enabled( &timeout ) ) { *(int*)(malloc( 12 )) = timeout; *(int*)malloc( 12 )/*.8*/ = dbus_timeout_get_interval( &timeout ); gui->add_timer( ebp_12, timeout_handler_cb, malloc( 12 ) + 8, malloc( 12 ) ); *(int*)malloc( 12 )/*.4*/ = ebp_12; dbus_timeout_set_data( &timeout, malloc( 12 ), &timeout_handler_dbus_freed ); } return 1; }
static dbus_bool_t add_timeout( DBusTimeout *p_timeout, void *p_data ) { intf_thread_t *p_intf = (intf_thread_t*) p_data; intf_sys_t *p_sys = (intf_sys_t*) p_intf->p_sys; timeout_info_t *p_info = calloc( 1, sizeof( timeout_info_t ) ); p_info->i_remaining = dbus_timeout_get_interval( p_timeout ) * 1000;/* µs */ p_info->p_timeout = p_timeout; dbus_timeout_set_data( p_timeout, p_info, free ); vlc_mutex_lock( &p_sys->lock ); vlc_array_append( p_sys->p_timeouts, p_timeout ); vlc_mutex_unlock( &p_sys->lock ); return TRUE; }
static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { timeout_handler_t *handler; if (!dbus_timeout_get_enabled(timeout)) return TRUE; handler = g_new0(timeout_handler_t, 1); handler->timeout = timeout; handler->id = g_timeout_add(dbus_timeout_get_interval(timeout), timeout_handler_dispatch, handler); dbus_timeout_set_data(timeout, handler, timeout_handler_free); return TRUE; }
/** * Decrements the reference count of a DBusTimeout object * and finalizes the object if the count reaches zero. * * @param timeout the timeout object. */ void _dbus_timeout_unref (DBusTimeout *timeout) { _dbus_assert (timeout != NULL); _dbus_assert (timeout->refcount > 0); timeout->refcount -= 1; if (timeout->refcount == 0) { dbus_timeout_set_data (timeout, NULL, NULL); /* call free_data_function */ if (timeout->free_handler_data_function) (* timeout->free_handler_data_function) (timeout->handler_data); dbus_free (timeout); } }
static dbus_bool_t add_timeout(DBusTimeout *to, void *data) { intf_thread_t *intf = data; intf_sys_t *sys = intf->p_sys; mtime_t *expiry = malloc(sizeof (*expiry)); if (unlikely(expiry == NULL)) return FALSE; dbus_timeout_set_data(to, expiry, free); vlc_mutex_lock(&sys->lock); vlc_array_append(sys->p_timeouts, to); vlc_mutex_unlock(&sys->lock); return TRUE; }
static dbus_bool_t efl_dbus_timeout_add(DBusTimeout *timeout, void *data) { struct timeout_handler *to_handler; if (dbus_timeout_get_enabled(timeout) == FALSE) return TRUE; to_handler = calloc(1, sizeof(struct timeout_handler)); if (to_handler == NULL) return FALSE; dbus_timeout_set_data(timeout, to_handler, timeout_handler_free); to_handler->e_timer = ecore_timer_add( dbus_timeout_get_interval(timeout), timeout_handler_dispatch, to_handler); return TRUE; }
static void connection_setup_add_timeout (ConnectionSetup *cs, DBusTimeout *timeout) { TimeoutHandler *handler; if (!dbus_timeout_get_enabled (timeout)) return; g_assert (dbus_timeout_get_data (timeout) == NULL); handler = g_new0 (TimeoutHandler, 1); handler->cs = cs; handler->timeout = timeout; handler->source = g_timeout_source_new (dbus_timeout_get_interval (timeout)); g_source_set_callback (handler->source, timeout_handler_dispatch, handler, timeout_handler_source_finalized); g_source_attach (handler->source, handler->cs->context); cs->timeouts = g_slist_prepend (cs->timeouts, handler); dbus_timeout_set_data (timeout, handler, timeout_handler_timeout_freed); }
static dbus_bool_t weston_dbus_add_timeout(DBusTimeout *timeout, void *data) { struct wl_event_loop *loop = data; struct wl_event_source *s; int r; s = wl_event_loop_add_timer(loop, weston_dbus_dispatch_timeout, timeout); if (!s) return FALSE; r = weston_dbus_adjust_timeout(timeout, s); if (r < 0) { wl_event_source_remove(s); return FALSE; } dbus_timeout_set_data(timeout, s, NULL); return TRUE; }
/* DBusAddTimeoutFunction callback for pa mainloop */ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { pa_dbus_wrap_connection *c = data; pa_time_event *ev; struct timeval tv; struct timeout_data *d; pa_assert(timeout); pa_assert(c); if (!dbus_timeout_get_enabled(timeout)) return FALSE; d = pa_xnew(struct timeout_data, 1); d->connection = c; d->timeout = timeout; ev = c->mainloop->time_new(c->mainloop, pa_timeval_rtstore(&tv, pa_rtclock_now() + dbus_timeout_get_interval(timeout) * PA_USEC_PER_MSEC, c->use_rtclock), handle_time_event, d); c->mainloop->time_set_destroy(ev, time_event_destroy_cb); dbus_timeout_set_data(timeout, ev, NULL); return TRUE; }
unsigned int DBusHandler::Callbacks::addTimeout(DBusTimeout* timeout, void* data) { if(!data) return 0; auto& loop = static_cast<DBusHandler*>(data)->compositor().wlEventLoop(); wl_event_source* source; if(!(source = wl_event_loop_add_timer(&loop, dispatchTimeout, timeout))) { ny::sendWarning("dbusAddTimeout: failed to add wl_event_loop_timer"); return 0; } if(adjustTimeout(timeout, source) < 0) { ny::sendWarning("dbusAddTimeout: failed to adjust timeout"); wl_event_source_remove(source); return 0; } dbus_timeout_set_data(timeout, source, nullptr); return true; }
static dbus_bool_t timeout_add (DBusTimeout * timeout, void *data) { TimeoutHandler *handler; hidval temp; // We won't create a timeout until it becomes enabled. if (!dbus_timeout_get_enabled (timeout)) { return TRUE; } //FIXME: Need to store the interval, as PCB requires us // to manually re-add the timer each time it expires. // This is non-ideal, and hopefully can be changed? handler = (TimeoutHandler *)malloc (sizeof (TimeoutHandler)); temp.ptr = (void *)handler; handler->dbus_timeout = timeout; handler->interval = dbus_timeout_get_interval (timeout); handler->pcb_timer = gui->add_timer (timeout_handler_cb, handler->interval, temp); dbus_timeout_set_data (timeout, handler, timeout_handler_dbus_freed); return TRUE; }
static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { EpollData *e; struct epoll_event ev; assert(timeout); e = new0(EpollData, 1); if (!e) return FALSE; e->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC); if (e->fd < 0) goto fail; e->object = timeout; e->is_timeout = true; if (timeout_arm(e) < 0) goto fail; zero(ev); ev.events = EPOLLIN; ev.data.ptr = e; if (epoll_ctl(PTR_TO_INT(data), EPOLL_CTL_ADD, e->fd, &ev) < 0) goto fail; dbus_timeout_set_data(timeout, e, NULL); return TRUE; fail: if (e->fd >= 0) close_nointr_nofail(e->fd); free(e); return FALSE; }
static dbus_bool_t timeout_add(DBusTimeout *timeout, void *data) { struct timeout *t; ev_tstamp interval = dbus_timeout_get_interval(timeout); lem_debug("timeout = %p, interval = %d, enabled = %s", (void *)timeout, dbus_timeout_get_interval(timeout), dbus_timeout_get_enabled(timeout) ? "true" : "false"); t = lem_xmalloc(sizeof(struct timeout)); interval = ((ev_tstamp)dbus_timeout_get_interval(timeout))/1000.0; ev_timer_init(&t->ev, timeout_handler, interval, interval); t->conn = data; t->timeout = timeout; dbus_timeout_set_data(timeout, t, NULL); if (dbus_timeout_get_enabled(timeout)) ev_timer_start(EV_G_ &t->ev); return TRUE; }
static void remove_timeout(DBusTimeout *timeout, void *data) { /* will trigger timeout_handler_free() */ dbus_timeout_set_data(timeout, NULL, NULL); }
static void connection_setup_remove_timeout(struct ctrl_iface_dbus_priv *iface, DBusTimeout *timeout) { eloop_cancel_timeout(process_timeout, iface, timeout); dbus_timeout_set_data(timeout, NULL, NULL); }
void timeout_remove( DBusTimeout *timeout, void *data ) { dbus_timeout_set_data( &timeout, 0, 0 ); return; }
static void efl_dbus_timeout_remove(DBusTimeout *timeout, void *data) { dbus_timeout_set_data(timeout, NULL, NULL); }
static void timeout_remove (DBusTimeout * timeout, void *data) { // Free the associated data. Its destroy callback removes the timer dbus_timeout_set_data (timeout, NULL, NULL); }