… | |
… | |
330 | }; |
330 | }; |
331 | |
331 | |
332 | static void |
332 | static void |
333 | x_once_cb (int revents, void *arg) |
333 | x_once_cb (int revents, void *arg) |
334 | { |
334 | { |
335 | struct x_once *once = arg; |
335 | struct x_once *once = (struct x_once *)arg; |
336 | |
336 | |
337 | once->cb (once->fd, revents, once->arg); |
337 | once->cb (once->fd, revents, once->arg); |
338 | free (once); |
338 | free (once); |
339 | } |
339 | } |
340 | |
340 | |
341 | int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv) |
341 | int event_base_once (struct event_base *base, int fd, short events, void (*cb)(int, short, void *), void *arg, struct timeval *tv) |
342 | { |
342 | { |
343 | struct x_once *once = malloc (sizeof (struct x_once)); |
343 | struct x_once *once = (struct x_once *)malloc (sizeof (struct x_once)); |
344 | dLOOPbase; |
344 | dLOOPbase; |
345 | |
345 | |
346 | if (!once) |
346 | if (!once) |
347 | return -1; |
347 | return -1; |
348 | |
348 | |