pthreadpool: make use of pthreadpool_stop() in pthreadpool_tevent_destructor()
authorStefan Metzmacher <metze@samba.org>
Wed, 25 Apr 2018 18:25:21 +0000 (20:25 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 12 Jul 2018 12:25:19 +0000 (14:25 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/pthreadpool/pthreadpool_tevent.c

index bfd178c09a6795b2f0d9ca11ca15e8032cf425aa..e73965370587c6704f6c05ed34dac88ae581abe8 100644 (file)
@@ -135,11 +135,10 @@ static int pthreadpool_tevent_destructor(struct pthreadpool_tevent *pool)
        struct pthreadpool_tevent_glue *glue = NULL;
        int ret;
 
-       ret = pthreadpool_destroy(pool->pool);
+       ret = pthreadpool_stop(pool->pool);
        if (ret != 0) {
                return ret;
        }
-       pool->pool = NULL;
 
        for (job = pool->jobs; job != NULL; job = njob) {
                njob = job->next;
@@ -159,6 +158,12 @@ static int pthreadpool_tevent_destructor(struct pthreadpool_tevent *pool)
        }
        pool->glue_list = NULL;
 
+       ret = pthreadpool_destroy(pool->pool);
+       if (ret != 0) {
+               return ret;
+       }
+       pool->pool = NULL;
+
        return 0;
 }