Add compatibility for multithreading

dev
senhuang42 2020-10-19 12:07:06 -04:00
parent aad436da37
commit b1c7fc5768
2 changed files with 8 additions and 1 deletions

View File

@ -1542,7 +1542,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
zc->isFirstBlock = 1;
if (params.cParams.strategy >= ZSTD_btopt && params.cParams.windowLog >= 27) {
if (params.cParams.strategy >= ZSTD_btopt && params.cParams.windowLog >= 27 && params.nbWorkers == 0) {
/* Enable LDM by default for optimal parser and window size >= 128MB */
DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)");
params.ldmParams.enableLdm = 1;

View File

@ -1459,6 +1459,13 @@ size_t ZSTDMT_initCStream_internal(
mtctx->params = params;
mtctx->frameContentSize = pledgedSrcSize;
if (params.cParams.strategy >= ZSTD_btopt && params.cParams.windowLog >= 27) {
/* Enable LDM by default for optimal parser and window size >= 128MB */
DEBUGLOG(4, "LDM enabled by default (window size >= 128MB, strategy >= btopt)");
params.ldmParams.enableLdm = 1;
}
if (dict) {
ZSTD_freeCDict(mtctx->cdictLocal);
mtctx->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,