summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-08-12 16:00:56 +0200
committerJeremy Allison <jra@samba.org>2016-08-24 01:33:48 +0200
commit2d55883e28e74b8e1d576e4a94a22d95a7b78618 (patch)
tree9ff672f9b6f038f20248f6da6473045f20e5e08c /lib/tevent
parent9d2ae4785d81d2679c41a99ed80032bb055bfdf4 (diff)
downloadsamba-2d55883e28e74b8e1d576e4a94a22d95a7b78618.tar.gz
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>
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index b8178b2d855..d286850c864 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -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]);
+}