Lines Matching refs:timeout

73 #define TIMEOUT_READY(timeout)   (timeout->flags & EGG_TIMEOUT_READY)  argument
140 EggTimeout *timeout, in egg_timeout_prepare() argument
148 if (timeout->last_time > now || now - timeout->last_time in egg_timeout_prepare()
149 > timeout->interval * 2) in egg_timeout_prepare()
151 timeout->last_time = now - timeout->interval; in egg_timeout_prepare()
156 else if (now - timeout->last_time >= timeout->interval) in egg_timeout_prepare()
165 *next_timeout = timeout->interval + timeout->last_time - now; in egg_timeout_prepare()
172 EggTimeout *timeout) in egg_timeout_dispatch() argument
176 if (G_UNLIKELY (!timeout->func)) in egg_timeout_dispatch()
182 if (timeout->func (timeout->data)) in egg_timeout_dispatch()
184 timeout->last_time += timeout->interval; in egg_timeout_dispatch()
195 EggTimeout *timeout; in egg_timeout_new() local
197 timeout = g_slice_new0 (EggTimeout); in egg_timeout_new()
198 timeout->interval = interval; in egg_timeout_new()
199 timeout->flags = EGG_TIMEOUT_NONE; in egg_timeout_new()
200 timeout->refcount = 1; in egg_timeout_new()
202 return timeout; in egg_timeout_new()
210 egg_timeout_ref (EggTimeout *timeout) in egg_timeout_ref() argument
212 g_return_val_if_fail (timeout != NULL, timeout); in egg_timeout_ref()
213 g_return_val_if_fail (timeout->refcount > 0, timeout); in egg_timeout_ref()
215 timeout->refcount += 1; in egg_timeout_ref()
217 return timeout; in egg_timeout_ref()
221 egg_timeout_unref (EggTimeout *timeout) in egg_timeout_unref() argument
223 g_return_if_fail (timeout != NULL); in egg_timeout_unref()
224 g_return_if_fail (timeout->refcount > 0); in egg_timeout_unref()
226 timeout->refcount -= 1; in egg_timeout_unref()
228 if (timeout->refcount == 0) in egg_timeout_unref()
230 if (timeout->notify) in egg_timeout_unref()
231 timeout->notify (timeout->data); in egg_timeout_unref()
233 g_slice_free (EggTimeout, timeout); in egg_timeout_unref()
238 egg_timeout_free (EggTimeout *timeout) in egg_timeout_free() argument
240 if (G_LIKELY (timeout)) in egg_timeout_free()
242 if (timeout->notify) in egg_timeout_free()
243 timeout->notify (timeout->data); in egg_timeout_free()
245 g_slice_free (EggTimeout, timeout); in egg_timeout_free()
259 EggTimeout *timeout = l->data; in egg_timeout_pool_prepare() local
260 return egg_timeout_prepare (pool, timeout, next_timeout); in egg_timeout_pool_prepare()
279 EggTimeout *timeout = l->data; in egg_timeout_pool_check() local
286 if (egg_timeout_prepare (pool, timeout, NULL)) in egg_timeout_pool_check()
288 timeout->flags |= EGG_TIMEOUT_READY; in egg_timeout_pool_check()
321 EggTimeout *timeout = pool->timeouts->data; in egg_timeout_pool_dispatch() local
329 if (!(TIMEOUT_READY (timeout))) in egg_timeout_pool_dispatch()
335 egg_timeout_ref (timeout); in egg_timeout_pool_dispatch()
337 timeout->flags &= ~EGG_TIMEOUT_READY; in egg_timeout_pool_dispatch()
353 if (!egg_timeout_dispatch (source, timeout)) in egg_timeout_pool_dispatch()
361 pool->dispatched_timeouts->data == timeout) in egg_timeout_pool_dispatch()
368 egg_timeout_unref (timeout); in egg_timeout_pool_dispatch()
372 egg_timeout_unref (timeout); in egg_timeout_pool_dispatch()
379 EggTimeout *timeout = dispatched_timeouts->data; in egg_timeout_pool_dispatch() local
382 if (timeout) in egg_timeout_pool_dispatch()
383 pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout, in egg_timeout_pool_dispatch()
496 EggTimeout *timeout; in egg_timeout_pool_add() local
499 timeout = egg_timeout_new (interval); in egg_timeout_pool_add()
501 retval = timeout->id = pool->next_id++; in egg_timeout_pool_add()
503 timeout->last_time = egg_timeout_pool_get_ticks (pool); in egg_timeout_pool_add()
504 timeout->func = func; in egg_timeout_pool_add()
505 timeout->data = data; in egg_timeout_pool_add()
506 timeout->notify = notify; in egg_timeout_pool_add()
508 pool->timeouts = g_list_insert_sorted (pool->timeouts, timeout, in egg_timeout_pool_add()