add a fd based event
return NULL on failure (memory allocation error)
*/
-struct fd_event *event_add_fd(struct event_context *ev, struct fd_event *e0)
+struct fd_event *event_add_fd(struct event_context *ev, struct fd_event *e0,
+ TALLOC_CTX *mem_ctx)
{
struct fd_event *e = talloc(ev->events, struct fd_event);
if (!e) return NULL;
ev->maxfd = e->fd;
}
talloc_set_destructor(e, event_fd_destructor);
+ if (mem_ctx) {
+ talloc_steal(mem_ctx, e);
+ }
return e;
}
add a timed event
return NULL on failure (memory allocation error)
*/
-struct timed_event *event_add_timed(struct event_context *ev, struct timed_event *e0)
+struct timed_event *event_add_timed(struct event_context *ev, struct timed_event *e0,
+ TALLOC_CTX *mem_ctx)
{
struct timed_event *e = talloc(ev->events, struct timed_event);
if (!e) return NULL;
e->event_ctx = ev;
DLIST_ADD(ev->timed_events, e);
talloc_set_destructor(e, event_timed_destructor);
+ if (mem_ctx) {
+ talloc_steal(mem_ctx, e);
+ }
return e;
}
add a loop event
return NULL on failure (memory allocation error)
*/
-struct loop_event *event_add_loop(struct event_context *ev, struct loop_event *e0)
+struct loop_event *event_add_loop(struct event_context *ev, struct loop_event *e0,
+ TALLOC_CTX *mem_ctx)
{
struct loop_event *e = talloc(ev->events, struct loop_event);
if (!e) return NULL;
e->event_ctx = ev;
DLIST_ADD(ev->loop_events, e);
talloc_set_destructor(e, event_loop_destructor);
+ if (mem_ctx) {
+ talloc_steal(mem_ctx, e);
+ }
return e;
}