]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added control stage to MT mode
authorYann Collet <cyan@fb.com>
Mon, 12 Jun 2017 01:32:36 +0000 (18:32 -0700)
committerYann Collet <cyan@fb.com>
Mon, 12 Jun 2017 01:32:36 +0000 (18:32 -0700)
lib/compress/zstd_compress.c
lib/compress/zstdmt_compress.c

index 48eb24ddf8ee19e053b86292405921a4efac67c3..338dd7472934ca745ccd62a3177ca673090afda9 100644 (file)
@@ -3762,13 +3762,15 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
                                     cctx->frameContentSize, 0 /* dictSize */);
         if (cctx->nbThreads > 1) {
             CHECK_F( ZSTDMT_initCStream_internal(cctx->mtctx, NULL, 0, cctx->cdict, params, cctx->frameContentSize) );
+            cctx->streamStage = zcss_load;
         } else {
             CHECK_F( ZSTD_resetCStream_internal(cctx, params, cctx->frameContentSize) );
     }   }
 
     if (cctx->nbThreads > 1) {
-        DEBUGLOG(5, "starting ZSTDMT_compressStream_generic");
-        return ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp) ;
+        size_t const flushMin = ZSTDMT_compressStream_generic(cctx->mtctx, output, input, endOp);
+        if (ZSTD_isError(flushMin)) cctx->streamStage = zcss_init;
+        return flushMin;
     }
 
     DEBUGLOG(5, "starting ZSTD_compressStream_generic");
index 09ac51218e98d856e0f4e34b7e7293bddfc13e7c..0984128249ce183636704f39624d61862c6663f0 100644 (file)
@@ -851,11 +851,11 @@ size_t ZSTDMT_endStream(ZSTDMT_CCtx* zcs, ZSTD_outBuffer* output)
 }
 
 size_t ZSTDMT_compressStream_generic(ZSTDMT_CCtx* mtctx,
-                                    ZSTD_outBuffer* output,
-                                    ZSTD_inBuffer* input,
-                                    ZSTD_EndDirective endOp)
+                                     ZSTD_outBuffer* output,
+                                     ZSTD_inBuffer* input,
+                                     ZSTD_EndDirective endOp)
 {
-    CHECK_F (ZSTDMT_compressStream(mtctx, output, input));
+    CHECK_F(ZSTDMT_compressStream(mtctx, output, input));
     switch(endOp)
     {
         case ZSTD_e_flush: