]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
reduced POOL_resize() restriction
authorYann Collet <cyan@fb.com>
Wed, 20 Jun 2018 01:07:18 +0000 (18:07 -0700)
committerYann Collet <cyan@fb.com>
Wed, 20 Jun 2018 01:07:18 +0000 (18:07 -0700)
It's not necessary to ensure that no job is ongoing.
The pool is only expanded, existing threads are preserved.
In case of error, the only option is to return NULL and terminate the thread pool anyway.

lib/common/pool.c
lib/compress/zstdmt_compress.c
lib/decompress/zstd_decompress.c

index e64833f87dbd95f3e05269da8337ec2a26f669f1..a0e2bedf0433a437e528d7931d4d36ea5788464d 100644 (file)
@@ -188,7 +188,6 @@ size_t POOL_sizeof(POOL_ctx *ctx) {
 /* note : only works if no job is running ! */
 static POOL_ctx* POOL_resize_internal(POOL_ctx* ctx, size_t numThreads)
 {
-    if (ctx->numThreadsBusy > 0) return NULL;
     if (numThreads <= ctx->threadCapacity) {
         ctx->threadLimit = numThreads;
         return ctx;
index 4a2a4cdd5a0d6bff9fd04a92adfe4666587c67eb..bbbdc5cd47e86642372dd55ab1adcf4d4ff60260 100644 (file)
@@ -1280,7 +1280,7 @@ size_t ZSTDMT_initCStream_internal(
 
     /* init */
     if (params.nbWorkers != mtctx->params.nbWorkers)
-        ZSTDMT_resize(mtctx, params.nbWorkers);
+        CHECK_F( ZSTDMT_resize(mtctx, params.nbWorkers) );
 
     if (params.jobSize == 0) {
         params.jobSize = 1U << ZSTDMT_computeTargetJobLog(params);
index 148c87f9d19e72a8333a20faca4383d11751c4c6..4de98a8e6983e4117e91ef8d85bd6bc4e87b601b 100644 (file)
@@ -1108,15 +1108,11 @@ size_t ZSTD_execSequence(BYTE* op,
             return sequenceLength;
         }
         /* span extDict & currentPrefixSegment */
-        DEBUGLOG(2, "ZSTD_execSequence: found a 2-segments match")
         {   size_t const length1 = dictEnd - match;
-            DEBUGLOG(2, "first part (extDict) is %zu bytes long", length1);
             memmove(oLitEnd, match, length1);
             op = oLitEnd + length1;
             sequence.matchLength -= length1;
-            DEBUGLOG(2, "second part (prefix) is %zu bytes long", sequence.matchLength);
             match = prefixStart;
-            DEBUGLOG(2, "first byte of 2nd part : %02X", *prefixStart);
             if (op > oend_w || sequence.matchLength < MINMATCH) {
               U32 i;
               for (i = 0; i < sequence.matchLength; ++i) op[i] = match[i];