From: Yann Collet Date: Wed, 11 Jan 2017 15:08:08 +0000 (+0100) Subject: minor refactor (release CCtx 1st) and comment clarification X-Git-Tag: v1.1.3^2~19^2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04cbc364996dc6688436500b327003b63537631c;p=thirdparty%2Fzstd.git minor refactor (release CCtx 1st) and comment clarification --- diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index 5fbf32b93..8471b7509 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -277,21 +277,21 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx, pthread_mutex_lock(&mtctx->jobCompleted_mutex); while (mtctx->jobs[frameID].jobCompleted==0) { - DEBUGLOG(4, "waiting for jobCompleted signal for frame %u", frameID); + DEBUGLOG(4, "waiting for jobCompleted signal from frame %u", frameID); pthread_cond_wait(&mtctx->jobCompleted_cond, &mtctx->jobCompleted_mutex); } pthread_mutex_unlock(&mtctx->jobCompleted_mutex); + ZSTDMT_releaseCCtx(mtctx->cctxPool, mtctx->jobs[frameID].cctx); { size_t const cSize = mtctx->jobs[frameID].cSize; if (ZSTD_isError(cSize)) return cSize; if (dstPos + cSize > dstCapacity) return ERROR(dstSize_tooSmall); - if (frameID) { + if (frameID) { /* note : frame 0 is already written directly into dst */ memcpy((char*)dst + dstPos, mtctx->jobs[frameID].dstBuff.start, cSize); ZSTDMT_releaseBuffer(mtctx->buffPool, mtctx->jobs[frameID].dstBuff); } dstPos += cSize ; } - ZSTDMT_releaseCCtx(mtctx->cctxPool, mtctx->jobs[frameID].cctx); } DEBUGLOG(3, "compressed size : %u ", (U32)dstPos); return dstPos;