mirror of
https://github.com/facebook/zstd.git
synced 2025-12-08 00:03:24 -05:00
fixed minor Visual conversion warning
This commit is contained in:
parent
377abcc02c
commit
2cd15dd9a4
@ -640,7 +640,7 @@ ZSTD_compressionParameters ZSTD_adjustCParams_internal(ZSTD_compressionParameter
|
|||||||
assert(ZSTD_checkCParams(cPar)==0);
|
assert(ZSTD_checkCParams(cPar)==0);
|
||||||
|
|
||||||
/* resize windowLog if src is small, to use less memory when necessary */
|
/* resize windowLog if src is small, to use less memory when necessary */
|
||||||
ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == -1ULL);
|
ZSTD_STATIC_ASSERT(ZSTD_CONTENTSIZE_UNKNOWN == (0ULL - 1));
|
||||||
if ( (dictSize || (srcSize+1 > 1)) /* srcSize test depends on static assert condition */
|
if ( (dictSize || (srcSize+1 > 1)) /* srcSize test depends on static assert condition */
|
||||||
&& (srcSize-1 < (1ULL<<ZSTD_WINDOWLOG_MAX)) ) /* no correction is srcSize is large enough */ {
|
&& (srcSize-1 < (1ULL<<ZSTD_WINDOWLOG_MAX)) ) /* no correction is srcSize is large enough */ {
|
||||||
U32 const minSrcSize = (srcSize==0) ? 513 : 0;
|
U32 const minSrcSize = (srcSize==0) ? 513 : 0;
|
||||||
|
|||||||
@ -494,11 +494,29 @@ static void ZSTDMT_releaseAllJobResources(ZSTDMT_CCtx* mtctx)
|
|||||||
mtctx->allJobsCompleted = 1;
|
mtctx->allJobsCompleted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
|
||||||
|
{
|
||||||
|
DEBUGLOG(4, "ZSTDMT_waitForAllJobsCompleted");
|
||||||
|
while (zcs->doneJobID < zcs->nextJobID) {
|
||||||
|
unsigned const jobID = zcs->doneJobID & zcs->jobIDMask;
|
||||||
|
PTHREAD_MUTEX_LOCK(&zcs->jobCompleted_mutex);
|
||||||
|
while (zcs->jobs[jobID].jobCompleted==0) {
|
||||||
|
DEBUGLOG(5, "waiting for jobCompleted signal from chunk %u", zcs->doneJobID); /* we want to block when waiting for data to flush */
|
||||||
|
pthread_cond_wait(&zcs->jobCompleted_cond, &zcs->jobCompleted_mutex);
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&zcs->jobCompleted_mutex);
|
||||||
|
zcs->doneJobID++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx)
|
size_t ZSTDMT_freeCCtx(ZSTDMT_CCtx* mtctx)
|
||||||
{
|
{
|
||||||
if (mtctx==NULL) return 0; /* compatible with free on NULL */
|
if (mtctx==NULL) return 0; /* compatible with free on NULL */
|
||||||
POOL_free(mtctx->factory);
|
POOL_free(mtctx->factory);
|
||||||
if (!mtctx->allJobsCompleted) ZSTDMT_releaseAllJobResources(mtctx); /* stop workers first */
|
if (!mtctx->allJobsCompleted) {
|
||||||
|
ZSTDMT_waitForAllJobsCompleted(mtctx);
|
||||||
|
ZSTDMT_releaseAllJobResources(mtctx); /* stop workers first */
|
||||||
|
}
|
||||||
ZSTDMT_freeBufferPool(mtctx->bufPool); /* release job resources into pools first */
|
ZSTDMT_freeBufferPool(mtctx->bufPool); /* release job resources into pools first */
|
||||||
ZSTD_free(mtctx->jobs, mtctx->cMem);
|
ZSTD_free(mtctx->jobs, mtctx->cMem);
|
||||||
ZSTDMT_freeCCtxPool(mtctx->cctxPool);
|
ZSTDMT_freeCCtxPool(mtctx->cctxPool);
|
||||||
@ -724,21 +742,6 @@ size_t ZSTDMT_compressCCtx(ZSTDMT_CCtx* mtctx,
|
|||||||
/* ======= Streaming API ======= */
|
/* ======= Streaming API ======= */
|
||||||
/* ====================================== */
|
/* ====================================== */
|
||||||
|
|
||||||
static void ZSTDMT_waitForAllJobsCompleted(ZSTDMT_CCtx* zcs)
|
|
||||||
{
|
|
||||||
DEBUGLOG(4, "ZSTDMT_waitForAllJobsCompleted");
|
|
||||||
while (zcs->doneJobID < zcs->nextJobID) {
|
|
||||||
unsigned const jobID = zcs->doneJobID & zcs->jobIDMask;
|
|
||||||
PTHREAD_MUTEX_LOCK(&zcs->jobCompleted_mutex);
|
|
||||||
while (zcs->jobs[jobID].jobCompleted==0) {
|
|
||||||
DEBUGLOG(5, "waiting for jobCompleted signal from chunk %u", zcs->doneJobID); /* we want to block when waiting for data to flush */
|
|
||||||
pthread_cond_wait(&zcs->jobCompleted_cond, &zcs->jobCompleted_mutex);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock(&zcs->jobCompleted_mutex);
|
|
||||||
zcs->doneJobID++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t ZSTDMT_initCStream_internal(
|
size_t ZSTDMT_initCStream_internal(
|
||||||
ZSTDMT_CCtx* zcs,
|
ZSTDMT_CCtx* zcs,
|
||||||
const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
|
const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user