mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
tevent: Move rundown of the event pipe
Purely cosmetic change: This moves closing the signal/thread event pipe to where it's opened. This prepares the eventfd support, making the "magic" for eventfd more obvious. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
9d2ae4785d
commit
2d55883e28
@ -178,6 +178,8 @@ const char **tevent_backend_list(TALLOC_CTX *mem_ctx)
|
||||
return list;
|
||||
}
|
||||
|
||||
static void tevent_common_wakeup_fini(struct tevent_context *ev);
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
|
||||
static pthread_mutex_t tevent_contexts_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
@ -297,12 +299,7 @@ int tevent_common_context_destructor(struct tevent_context *ev)
|
||||
tevent_abort(ev, "threaded contexts exist");
|
||||
}
|
||||
|
||||
if (ev->pipe_fde) {
|
||||
talloc_free(ev->pipe_fde);
|
||||
close(ev->pipe_fds[0]);
|
||||
close(ev->pipe_fds[1]);
|
||||
ev->pipe_fde = NULL;
|
||||
}
|
||||
tevent_common_wakeup_fini(ev);
|
||||
|
||||
for (fd = ev->fd_events; fd; fd = fn) {
|
||||
fn = fd->next;
|
||||
@ -896,3 +893,15 @@ int tevent_common_wakeup(struct tevent_context *ev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tevent_common_wakeup_fini(struct tevent_context *ev)
|
||||
{
|
||||
if (ev->pipe_fde == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
TALLOC_FREE(ev->pipe_fde);
|
||||
|
||||
close(ev->pipe_fds[0]);
|
||||
close(ev->pipe_fds[1]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user