/* a pointer back to the generic event_context */
struct tevent_context *ev;
- /* this is changed by the destructors for the fd event
- type. It is used to detect event destruction by event
- handlers, which means the code that is calling the event
- handler needs to assume that the linked list is no longer
- valid
- */
- uint32_t destruction_count;
-
/* when using epoll this is the handle from epoll_create */
int epoll_fd;
static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval *tvalp)
{
int ret, i;
-#define MAXEVENTS 32
+#define MAXEVENTS 1
struct epoll_event events[MAXEVENTS];
- uint32_t destruction_count = ++epoll_ev->destruction_count;
int timeout = -1;
if (epoll_ev->epoll_fd == -1) return -1;
if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(epoll_ev->ev, fde, flags, fde->private_data);
- if (destruction_count != epoll_ev->destruction_count) {
- break;
- }
+ break;
}
}
epoll_check_reopen(epoll_ev);
- epoll_ev->destruction_count++;
-
epoll_del_event(epoll_ev, fde);
}
/* information for exiting from the event loop */
int exit_code;
-
- /* this is incremented when the loop over events causes something which
- could change the events yet to be processed */
- uint32_t destruction_count;
};
/*
if (select_ev->maxfd == fde->fd) {
select_ev->maxfd = EVENT_INVALID_MAXFD;
}
-
- select_ev->destruction_count++;
}
return tevent_common_fd_destructor(fde);
fd_set r_fds, w_fds;
struct tevent_fd *fde;
int selrtn;
- uint32_t destruction_count = ++select_ev->destruction_count;
/* we maybe need to recalculate the maxfd */
if (select_ev->maxfd == EVENT_INVALID_MAXFD) {
if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(select_ev->ev, fde, flags, fde->private_data);
- if (destruction_count != select_ev->destruction_count) {
- break;
- }
+ break;
}
}
}
return 0;
-}
+}
/*
do a single event loop using the events defined in ev
/* information for exiting from the event loop */
int exit_code;
- /* this is changed by the destructors for the fd event
- type. It is used to detect event destruction by event
- handlers, which means the code that is calling the event
- handler needs to assume that the linked list is no longer
- valid
- */
- uint32_t destruction_count;
-
/* when using epoll this is the handle from epoll_create */
int epoll_fd;
static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tvalp)
{
int ret, i;
-#define MAXEVENTS 8
+#define MAXEVENTS 1
struct epoll_event events[MAXEVENTS];
- uint32_t destruction_count = ++std_ev->destruction_count;
int timeout = -1;
if (std_ev->epoll_fd == -1) return -1;
if (events[i].events & EPOLLOUT) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
- if (destruction_count != std_ev->destruction_count) {
- break;
- }
+ break;
}
}
std_ev->maxfd = EVENT_INVALID_MAXFD;
}
- std_ev->destruction_count++;
-
epoll_del_event(std_ev, fde);
}
fd_set r_fds, w_fds;
struct tevent_fd *fde;
int selrtn;
- uint32_t destruction_count = ++std_ev->destruction_count;
/* we maybe need to recalculate the maxfd */
if (std_ev->maxfd == EVENT_INVALID_MAXFD) {
if (FD_ISSET(fde->fd, &w_fds)) flags |= TEVENT_FD_WRITE;
if (flags) {
fde->handler(std_ev->ev, fde, flags, fde->private_data);
- if (destruction_count != std_ev->destruction_count) {
- break;
- }
+ break;
}
}
}