*/
#include "includes.h"
+#define TEVENT_DEPRECATED 1
#include "lib/events/events.h"
/*
samba_level = 2;
break;
case TEVENT_DEBUG_TRACE:
- samba_level = 5;
+ samba_level = 50;
break;
};
vasprintf(&s, fmt, ap);
if (!s) return;
- DEBUG(samba_level, ("tevent: %s\n", s));
+ DEBUG(samba_level, ("tevent: %s", s));
free(s);
}
ev = tevent_context_init_byname(mem_ctx, NULL);
if (ev) {
tevent_set_debug(ev, ev_wrap_debug, NULL);
+ tevent_loop_allow_nesting(ev);
}
return ev;
}
+static struct tevent_context *default_tevent_context;
+
+/* set a default event context that will be used for
+ * event_context_find() if a parent event context is not found
+ */
+void s4_event_context_set_default(struct tevent_context *ev)
+{
+ default_tevent_context = ev;
+}
+
/*
find an event context that is a parent of the given memory context,
or create a new event context as a child of the given context if
struct tevent_context *event_context_find(TALLOC_CTX *mem_ctx)
{
struct tevent_context *ev = talloc_find_parent_bytype(mem_ctx, struct tevent_context);
- if (ev == NULL) {
- ev = tevent_context_init(mem_ctx);
+ if (ev == NULL) {
+ ev = default_tevent_context;
+ }
+ if (ev == NULL) {
+ ev = s4_event_context_init(mem_ctx);
}
return ev;
}