]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
added MT support to NEWAPI
authorYann Collet <cyan@fb.com>
Mon, 12 Jun 2017 01:39:46 +0000 (18:39 -0700)
committerYann Collet <cyan@fb.com>
Mon, 12 Jun 2017 01:39:46 +0000 (18:39 -0700)
programs/fileio.c

index e7c58a969a15203f52a8382027e426b0e26dff36..bbf52168a8310a8cc743ff2c3b7c8655dc2ba4f3 100644 (file)
@@ -379,10 +379,9 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
         size_t const dictBuffSize = FIO_createDictBuffer(&dictBuffer, dictFileName);   /* works with dictFileName==NULL */
         if (dictFileName && (dictBuffer==NULL))
             EXM_THROW(32, "allocation error : can't create dictBuffer");
-//#define ZSTD_NEWAPI
+
 #ifdef ZSTD_NEWAPI
-        {
-            /* frame parameters */
+        {   /* frame parameters */
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_contentSizeFlag, srcIsRegularFile) );
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_dictIDFlag, g_dictIDFlag) );
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_checksumFlag, g_checksumFlag) );
@@ -396,6 +395,8 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_minMatch, comprParams->searchLength) );
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_targetLength, comprParams->targetLength) );
             CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_compressionStrategy, (U32)comprParams->strategy) );
+            /* multi-threading */
+            CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_nbThreads, g_nbThreads) );
             /* dictionary */
             CHECK( ZSTD_CCtx_loadDictionary(ress.cctx, dictBuffer, dictBuffSize) );
         }