added control stage to MT mode

This commit is contained in:
Yann Collet 2017-06-11 18:32:36 -07:00
parent f35e2de61c
commit 23aace9778
2 changed files with 8 additions and 6 deletions

View 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");

View 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: