summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-12 09:22:41 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-12 12:04:33 +0100
commit880d9d6d8c209c770185b9b1c9a3019cb56be763 (patch)
treebf0acc14262d639cd1060d6b26af9f7f79d73b8c
parent43a7d48d24b357872dc31c1088e468ad2b719b73 (diff)
downloadsamba-880d9d6d8c209c770185b9b1c9a3019cb56be763.tar.gz
samba-880d9d6d8c209c770185b9b1c9a3019cb56be763.tar.bz2
samba-880d9d6d8c209c770185b9b1c9a3019cb56be763.zip
tevent: add tevent_set_abort_fn()
metze
-rw-r--r--lib/tevent/tevent.c19
-rw-r--r--lib/tevent/tevent.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index fd273afb66..943d4d6bc2 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -313,6 +313,25 @@ bool tevent_signal_support(struct tevent_context *ev)
return false;
}
+static void (*tevent_abort_fn)(const char *reason);
+
+void tevent_set_abort_fn(void (*abort_fn)(const char *reason))
+{
+ tevent_abort_fn = abort_fn;
+}
+
+static void tevent_abort(struct tevent_context *ev, const char *reason)
+{
+ tevent_debug(ev, TEVENT_DEBUG_FATAL,
+ "abort: %s\n", reason);
+
+ if (!tevent_abort_fn) {
+ abort();
+ }
+
+ tevent_abort_fn(reason);
+}
+
/*
add a timer event
return NULL on failure
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 1f4cf2d329..90d0767f87 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -110,6 +110,8 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
bool tevent_signal_support(struct tevent_context *ev);
+void tevent_set_abort_fn(void (*abort_fn)(const char *reason));
+
/* bits for file descriptor event flags */
#define TEVENT_FD_READ 1
#define TEVENT_FD_WRITE 2