lib: tevent: Minor cleanup. wakeup_fd can always be gotten from the event context.
authorJeremy Allison <jra@samba.org>
Sat, 11 Nov 2017 03:26:55 +0000 (19:26 -0800)
committerRalph Boehme <slow@samba.org>
Fri, 17 Nov 2017 11:43:01 +0000 (12:43 +0100)
We don't need to store it. I prefer this as it shows that we must always
get wakeup_fd from the event context at time of use, rather than possibly
storing an out-of-date variable.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Nov 17 12:43:01 CET 2017 on sn-devel-144

lib/tevent/tevent_internal.h
lib/tevent/tevent_threads.c

index 47ea39b3cd189d47d17e55aa1b01b5c7388d5516..ec3955e70a492dfb340328dc1fdbd75af9b053bd 100644 (file)
@@ -235,7 +235,6 @@ struct tevent_threaded_context {
        pthread_mutex_t event_ctx_mutex;
 #endif
        struct tevent_context *event_ctx;
-       int wakeup_fd;
 };
 
 struct tevent_debug_ops {
index 2e83f1b66c27df1ed67cf79fe28e823902e5009a..2c6e66b09049fe4a2ade8abed8a389f53996e9e0 100644 (file)
@@ -424,7 +424,6 @@ struct tevent_threaded_context *tevent_threaded_context_create(
                return NULL;
        }
        tctx->event_ctx = ev;
-       tctx->wakeup_fd = ev->wakeup_fd;
 
        ret = pthread_mutex_init(&tctx->event_ctx_mutex, NULL);
        if (ret != 0) {
@@ -489,14 +488,13 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
        }
 
        DLIST_ADD_END(ev->scheduled_immediates, im);
+       wakeup_fd = ev->wakeup_fd;
 
        ret = pthread_mutex_unlock(&ev->scheduled_mutex);
        if (ret != 0) {
                abort();
        }
 
-       wakeup_fd = tctx->wakeup_fd;
-
        ret = pthread_mutex_unlock(&tctx->event_ctx_mutex);
        if (ret != 0) {
                abort();