]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
cli: fix for no-MT mode
authorYann Collet <cyan@fb.com>
Wed, 17 Jan 2018 01:28:11 +0000 (17:28 -0800)
committerYann Collet <cyan@fb.com>
Wed, 17 Jan 2018 01:28:11 +0000 (17:28 -0800)
when cli is compiled without MT support,
invoking ZSTD_p_nonBlockingMode result in an error code.

This patch only sets ZSTD_p_nonBlockingMode when ZSTD_MULTITHREAD is set, meaning there is MT support.

The error code could also be intentionnally ignored (there is no side effect).

programs/fileio.c

index ea84853c7de5320d50f4544c9a577ce9cc4d6c90..58b77a8132603655ce74ce36a5051d554b8146d8 100644 (file)
@@ -457,7 +457,9 @@ static cRess_t FIO_createCResources(const char* dictFileName, int cLevel,
         /* multi-threading */
         DISPLAYLEVEL(5,"set nb threads = %u \n", g_nbThreads);
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_nbThreads, g_nbThreads) );
+#ifdef ZSTD_MULTITHREAD
         CHECK( ZSTD_CCtx_setParameter(ress.cctx, ZSTD_p_nonBlockingMode, 1) );
+#endif
         /* dictionary */
         CHECK( ZSTD_CCtx_setPledgedSrcSize(ress.cctx, srcSize) );  /* just for dictionary loading, for compression parameters adaptation */
         CHECK( ZSTD_CCtx_loadDictionary(ress.cctx, dictBuffer, dictBuffSize) );