]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
removed ZSTDMT_waitForAllJobsCompleted() from ZSTDMT_freeCCtx()
authorYann Collet <cyan@fb.com>
Fri, 29 Sep 2017 03:44:22 +0000 (20:44 -0700)
committerYann Collet <cyan@fb.com>
Fri, 29 Sep 2017 03:45:31 +0000 (20:45 -0700)
as per @terrelln comment

lib/compress/zstdmt_compress.c

index bc7d1e540c65a1c169c11eba65edf953ac9ca590..bfa1c42da5543777b124a887fb00659e126abcd8 100644 (file)
@@ -514,13 +514,10 @@ static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
 size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx)
 {
     if (mtctx==NULL) return 0;   /* compatible with free on NULL */
-    POOL_free(mtctx->factory);
-    if (!mtctx->allJobsCompleted) {
-        ZSTDMT_waitForAllJobsCompleted(mtctx);
-        ZSTDMT_releaseAllJobResources(mtctx); /* stop workers first */
-    }
-    ZSTDMT_freeBufferPool(mtctx->bufPool);  /* release job resources into pools first */
+    POOL_free(mtctx->factory);   /* stop and free worker threads */
+    ZSTDMT_releaseAllJobResources(mtctx);  /* release job resources into pools first */
     ZSTD_free(mtctx->jobs, mtctx->cMem);
+    ZSTDMT_freeBufferPool(mtctx->bufPool);
     ZSTDMT_freeCCtxPool(mtctx->cctxPool);
     ZSTD_freeCDict(mtctx->cdictLocal);
     ZSTD_pthread_mutex_destroy(&mtctx->jobCompleted_mutex);