Lines Matching refs:eloop
13 #include "eloop.h"
53 static struct eloop_data eloop;
58 os_memset(&eloop, 0, sizeof(eloop));
59 dl_list_init(&eloop.timeout);
69 tmp = os_realloc_array(eloop.readers, eloop.reader_count + 1,
74 tmp[eloop.reader_count].sock = sock;
75 tmp[eloop.reader_count].eloop_data = eloop_data;
76 tmp[eloop.reader_count].user_data = user_data;
77 tmp[eloop.reader_count].handler = handler;
78 eloop.reader_count++;
79 eloop.readers = tmp;
80 if (sock > eloop.max_sock)
81 eloop.max_sock = sock;
82 eloop.reader_table_changed = 1;
92 if (eloop.readers == NULL || eloop.reader_count == 0)
95 for (i = 0; i < eloop.reader_count; i++) {
96 if (eloop.readers[i].sock == sock)
99 if (i == eloop.reader_count)
101 if (i != eloop.reader_count - 1) {
102 os_memmove(&eloop.readers[i], &eloop.readers[i + 1],
103 (eloop.reader_count - i - 1) *
106 eloop.reader_count--;
107 eloop.reader_table_changed = 1;
132 wpa_printf(MSG_DEBUG, "ELOOP: Too long timeout (secs=%u) to "
147 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
153 dl_list_add_tail(&eloop.timeout, &timeout->list);
172 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
199 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
220 dl_list_for_each(tmp, &eloop.timeout, struct eloop_timeout, list) {
237 eloop.signaled++;
238 for (i = 0; i < eloop.signal_count; i++) {
239 if (eloop.signals[i].sig == sig) {
240 eloop.signals[i].signaled++;
252 if (eloop.signaled == 0)
254 eloop.signaled = 0;
256 if (eloop.pending_terminate) {
257 eloop.pending_terminate = 0;
260 for (i = 0; i < eloop.signal_count; i++) {
261 if (eloop.signals[i].signaled) {
262 eloop.signals[i].signaled = 0;
263 eloop.signals[i].handler(eloop.signals[i].sig,
264 eloop.signals[i].user_data);
275 tmp = os_realloc_array(eloop.signals, eloop.signal_count + 1,
280 tmp[eloop.signal_count].sig = sig;
281 tmp[eloop.signal_count].user_data = user_data;
282 tmp[eloop.signal_count].handler = handler;
283 tmp[eloop.signal_count].signaled = 0;
284 eloop.signal_count++;
285 eloop.signals = tmp;
323 while (!eloop.terminate &&
324 (!dl_list_empty(&eloop.timeout) || eloop.reader_count > 0)) {
326 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
345 timeout = dl_list_first(&eloop.timeout, struct eloop_timeout,
360 eloop.reader_table_changed = 0;
361 for (i = 0; i < eloop.reader_count; i++) {
366 if (0 /* TODO: eloop.readers[i].sock ready */) {
367 eloop.readers[i].handler(
368 eloop.readers[i].sock,
369 eloop.readers[i].eloop_data,
370 eloop.readers[i].user_data);
371 if (eloop.reader_table_changed)
381 eloop.terminate = 1;
389 dl_list_for_each_safe(timeout, prev, &eloop.timeout,
393 os_free(eloop.readers);
394 os_free(eloop.signals);
400 return eloop.terminate;