Lines Matching refs:list
57 BusExpireList *list; in bus_expire_list_new() local
59 list = dbus_new0 (BusExpireList, 1); in bus_expire_list_new()
60 if (list == NULL) in bus_expire_list_new()
63 list->expire_func = expire_func; in bus_expire_list_new()
64 list->data = data; in bus_expire_list_new()
65 list->loop = loop; in bus_expire_list_new()
66 list->expire_after = expire_after; in bus_expire_list_new()
68 list->timeout = _dbus_timeout_new (100, /* irrelevant */ in bus_expire_list_new()
70 list, NULL); in bus_expire_list_new()
71 if (list->timeout == NULL) in bus_expire_list_new()
74 _dbus_timeout_set_enabled (list->timeout, FALSE); in bus_expire_list_new()
76 if (!_dbus_loop_add_timeout (list->loop, in bus_expire_list_new()
77 list->timeout, in bus_expire_list_new()
81 return list; in bus_expire_list_new()
84 if (list->timeout) in bus_expire_list_new()
85 _dbus_timeout_unref (list->timeout); in bus_expire_list_new()
87 dbus_free (list); in bus_expire_list_new()
93 bus_expire_list_free (BusExpireList *list) in bus_expire_list_free() argument
95 _dbus_assert (list->items == NULL); in bus_expire_list_free()
97 _dbus_loop_remove_timeout (list->loop, list->timeout, in bus_expire_list_free()
100 _dbus_timeout_unref (list->timeout); in bus_expire_list_free()
102 dbus_free (list); in bus_expire_list_free()
129 bus_expire_list_recheck_immediately (BusExpireList *list) in bus_expire_list_recheck_immediately() argument
133 bus_expire_timeout_set_interval (list->timeout, 0); in bus_expire_list_recheck_immediately()
137 do_expiration_with_current_time (BusExpireList *list, in do_expiration_with_current_time() argument
148 link = _dbus_list_get_first_link (&list->items); in do_expiration_with_current_time()
151 DBusList *next = _dbus_list_get_next_link (&list->items, link); in do_expiration_with_current_time()
162 ((list->expire_after > 0) && (elapsed >= (double) list->expire_after))) in do_expiration_with_current_time()
172 if (!(* list->expire_func) (list, link, list->data)) in do_expiration_with_current_time()
178 else if (list->expire_after > 0) in do_expiration_with_current_time()
183 to_wait = (double) list->expire_after - elapsed; in do_expiration_with_current_time()
198 bus_expirelist_expire (BusExpireList *list) in bus_expirelist_expire() argument
204 if (list->items != NULL) in bus_expirelist_expire()
210 next_interval = do_expiration_with_current_time (list, tv_sec, tv_usec); in bus_expirelist_expire()
213 bus_expire_timeout_set_interval (list->timeout, next_interval); in bus_expirelist_expire()
219 BusExpireList *list = data; in expire_timeout_handler() local
224 bus_expirelist_expire (list); in expire_timeout_handler()
230 bus_expire_list_remove_link (BusExpireList *list, in bus_expire_list_remove_link() argument
233 _dbus_list_remove_link (&list->items, link); in bus_expire_list_remove_link()
237 bus_expire_list_remove (BusExpireList *list, in bus_expire_list_remove() argument
240 return _dbus_list_remove (&list->items, item); in bus_expire_list_remove()
244 bus_expire_list_unlink (BusExpireList *list, in bus_expire_list_unlink() argument
247 _dbus_list_unlink (&list->items, link); in bus_expire_list_unlink()
251 bus_expire_list_add (BusExpireList *list, in bus_expire_list_add() argument
256 ret = _dbus_list_prepend (&list->items, item); in bus_expire_list_add()
257 if (ret && !dbus_timeout_get_enabled (list->timeout)) in bus_expire_list_add()
258 bus_expire_timeout_set_interval (list->timeout, 0); in bus_expire_list_add()
264 bus_expire_list_add_link (BusExpireList *list, in bus_expire_list_add_link() argument
269 _dbus_list_prepend_link (&list->items, link); in bus_expire_list_add_link()
271 if (!dbus_timeout_get_enabled (list->timeout)) in bus_expire_list_add_link()
272 bus_expire_timeout_set_interval (list->timeout, 0); in bus_expire_list_add_link()
276 bus_expire_list_get_first_link (BusExpireList *list) in bus_expire_list_get_first_link() argument
278 return _dbus_list_get_first_link (&list->items); in bus_expire_list_get_first_link()
282 bus_expire_list_get_next_link (BusExpireList *list, in bus_expire_list_get_next_link() argument
285 return _dbus_list_get_next_link (&list->items, link); in bus_expire_list_get_next_link()
289 bus_expire_list_contains_item (BusExpireList *list, in bus_expire_list_contains_item() argument
292 return _dbus_list_find_last (&list->items, item) != NULL; in bus_expire_list_contains_item()
304 test_expire_func (BusExpireList *list, in test_expire_func() argument
335 BusExpireList *list; in bus_expire_list_test() local
350 list = bus_expire_list_new (loop, EXPIRE_AFTER, in bus_expire_list_test()
352 _dbus_assert (list != NULL); in bus_expire_list_test()
377 if (!bus_expire_list_add (list, &item->item)) in bus_expire_list_test()
381 do_expiration_with_current_time (list, tv_sec_not_expired, in bus_expire_list_test()
388 do_expiration_with_current_time (list, tv_sec_expired, in bus_expire_list_test()
395 do_expiration_with_current_time (list, tv_sec_past, in bus_expire_list_test()
401 bus_expire_list_remove (list, &item->item); in bus_expire_list_test()
404 bus_expire_list_free (list); in bus_expire_list_test()