mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
tevent: add tevent_set_abort_fn()
metze
This commit is contained in:
parent
43a7d48d24
commit
880d9d6d8c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user