tevent: add tevent_threaded_schedule_immediate_destructor that just aborts
authorStefan Metzmacher <metze@samba.org>
Fri, 23 Mar 2018 09:32:15 +0000 (10:32 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:51:46 +0000 (09:51 +0200)
lib/tevent/tevent_threads.c

index 3f91ab8bc2abf01957526f6dba204c2edb2bc092..f8efb57a68d99d9131ac1a520db9b210f1a3fba9 100644 (file)
@@ -441,6 +441,14 @@ struct tevent_threaded_context *tevent_threaded_context_create(
 #endif
 }
 
+static int tevent_threaded_schedule_immediate_destructor(struct tevent_immediate *im)
+{
+       if (im->event_ctx != NULL) {
+               abort();
+       }
+       return 0;
+}
+
 void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
                                         struct tevent_immediate *im,
                                         tevent_immediate_handler_t handler,
@@ -484,6 +492,8 @@ void _tevent_threaded_schedule_immediate(struct tevent_threaded_context *tctx,
                .schedule_location      = location,
        };
 
+       talloc_set_destructor(im, tevent_threaded_schedule_immediate_destructor);
+
        ret = pthread_mutex_lock(&ev->scheduled_mutex);
        if (ret != 0) {
                abort();