/*
called to set the panic fallback function.
*/
-_PRIVATE_ bool tevent_epoll_set_panic_fallback(struct tevent_context *ev,
+_PRIVATE_ void tevent_epoll_set_panic_fallback(struct tevent_context *ev,
bool (*panic_fallback)(struct tevent_context *ev,
bool replay))
{
- struct epoll_event_context *epoll_ev;
-
- if (ev->additional_data == NULL) {
- return false;
- }
+ struct epoll_event_context *epoll_ev =
+ talloc_get_type_abort(ev->additional_data,
+ struct epoll_event_context);
- epoll_ev = talloc_get_type(ev->additional_data,
- struct epoll_event_context);
- if (epoll_ev == NULL) {
- return false;
- }
epoll_ev->panic_fallback = panic_fallback;
- return true;
}
/*
/*
reopen the epoll handle when our pid changes
- see http://junkcode.samba.org/ftp/unpacked/junkcode/epoll_fork.c for an
+ see http://junkcode.samba.org/ftp/unpacked/junkcode/epoll_fork.c for an
demonstration of why this is needed
*/
static void epoll_check_reopen(struct epoll_event_context *epoll_ev)
}
for (i=0;i<ret;i++) {
- struct tevent_fd *fde = talloc_get_type(events[i].data.ptr,
+ struct tevent_fd *fde = talloc_get_type(events[i].data.ptr,
struct tevent_fd);
uint16_t flags = 0;
struct tevent_fd *mpx_fde = NULL;
const char *handler_name,
const char *location)
{
- struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
- struct epoll_event_context);
+ struct epoll_event_context *epoll_ev =
+ talloc_get_type_abort(ev->additional_data,
+ struct epoll_event_context);
struct tevent_fd *fde;
bool panic_triggered = false;
if (fde->flags == flags) return;
ev = fde->event_ctx;
- epoll_ev = talloc_get_type(ev->additional_data, struct epoll_event_context);
+ epoll_ev = talloc_get_type_abort(ev->additional_data,
+ struct epoll_event_context);
fde->flags = flags;
}
/*
- do a single event loop using the events defined in ev
+ do a single event loop using the events defined in ev
*/
static int epoll_event_loop_once(struct tevent_context *ev, const char *location)
{
- struct epoll_event_context *epoll_ev = talloc_get_type(ev->additional_data,
- struct epoll_event_context);
+ struct epoll_event_context *epoll_ev =
+ talloc_get_type_abort(ev->additional_data,
+ struct epoll_event_context);
struct timeval tval;
bool panic_triggered = false;
return 0;
}
+ if (ev->threaded_contexts != NULL) {
+ tevent_common_threaded_activate_immediate(ev);
+ }
+
if (ev->immediate_events &&
tevent_common_loop_immediate(ev)) {
return 0;
.set_fd_close_fn = tevent_common_fd_set_close_fn,
.get_fd_flags = tevent_common_fd_get_flags,
.set_fd_flags = epoll_event_set_fd_flags,
- .add_timer = tevent_common_add_timer,
+ .add_timer = tevent_common_add_timer_v2,
.schedule_immediate = tevent_common_schedule_immediate,
.add_signal = tevent_common_add_signal,
.loop_once = epoll_event_loop_once,