Lines Matching refs:cctxPool
370 ZSTDMT_CCtxPool* const cctxPool = (ZSTDMT_CCtxPool*) ZSTD_customCalloc( in ZSTDMT_createCCtxPool() local
373 if (!cctxPool) return NULL; in ZSTDMT_createCCtxPool()
374 if (ZSTD_pthread_mutex_init(&cctxPool->poolMutex, NULL)) { in ZSTDMT_createCCtxPool()
375 ZSTD_customFree(cctxPool, cMem); in ZSTDMT_createCCtxPool()
378 cctxPool->cMem = cMem; in ZSTDMT_createCCtxPool()
379 cctxPool->totalCCtx = nbWorkers; in ZSTDMT_createCCtxPool()
380 cctxPool->availCCtx = 1; /* at least one cctx for single-thread mode */ in ZSTDMT_createCCtxPool()
381 cctxPool->cctx[0] = ZSTD_createCCtx_advanced(cMem); in ZSTDMT_createCCtxPool()
382 if (!cctxPool->cctx[0]) { ZSTDMT_freeCCtxPool(cctxPool); return NULL; } in ZSTDMT_createCCtxPool()
384 return cctxPool; in ZSTDMT_createCCtxPool()
400 static size_t ZSTDMT_sizeof_CCtxPool(ZSTDMT_CCtxPool* cctxPool) in ZSTDMT_sizeof_CCtxPool() argument
402 ZSTD_pthread_mutex_lock(&cctxPool->poolMutex); in ZSTDMT_sizeof_CCtxPool()
403 { unsigned const nbWorkers = cctxPool->totalCCtx; in ZSTDMT_sizeof_CCtxPool()
404 size_t const poolSize = sizeof(*cctxPool) in ZSTDMT_sizeof_CCtxPool()
409 totalCCtxSize += ZSTD_sizeof_CCtx(cctxPool->cctx[u]); in ZSTDMT_sizeof_CCtxPool()
411 ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex); in ZSTDMT_sizeof_CCtxPool()
417 static ZSTD_CCtx* ZSTDMT_getCCtx(ZSTDMT_CCtxPool* cctxPool) in ZSTDMT_getCCtx() argument
420 ZSTD_pthread_mutex_lock(&cctxPool->poolMutex); in ZSTDMT_getCCtx()
421 if (cctxPool->availCCtx) { in ZSTDMT_getCCtx()
422 cctxPool->availCCtx--; in ZSTDMT_getCCtx()
423 { ZSTD_CCtx* const cctx = cctxPool->cctx[cctxPool->availCCtx]; in ZSTDMT_getCCtx()
424 ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex); in ZSTDMT_getCCtx()
427 ZSTD_pthread_mutex_unlock(&cctxPool->poolMutex); in ZSTDMT_getCCtx()
429 … return ZSTD_createCCtx_advanced(cctxPool->cMem); /* note : can be NULL, when creation fails ! */ in ZSTDMT_getCCtx()
642 ZSTDMT_CCtxPool* cctxPool; /* Thread-safe - used by mtctx and (all) workers */ member
671 ZSTD_CCtx* const cctx = ZSTDMT_getCCtx(job->cctxPool); in ZSTDMT_compressionJob()
780 ZSTDMT_releaseCCtx(job->cctxPool, cctx); in ZSTDMT_compressionJob()
838 ZSTDMT_CCtxPool* cctxPool; member
948 mtctx->cctxPool = ZSTDMT_createCCtxPool(nbWorkers, cMem); in ZSTDMT_createCCtx_advanced_internal()
952 …if (!mtctx->factory | !mtctx->jobs | !mtctx->bufPool | !mtctx->cctxPool | !mtctx->seqPool | initEr… in ZSTDMT_createCCtx_advanced_internal()
1020 ZSTDMT_freeCCtxPool(mtctx->cctxPool); in ZSTDMT_freeCCtx()
1037 + ZSTDMT_sizeof_CCtxPool(mtctx->cctxPool) in ZSTDMT_sizeof_CCtx()
1052 mtctx->cctxPool = ZSTDMT_expandCCtxPool(mtctx->cctxPool, nbWorkers); in ZSTDMT_resize()
1053 if (mtctx->cctxPool == NULL) return ERROR(memory_allocation); in ZSTDMT_resize()
1224 (U32)pledgedSrcSize, params.nbWorkers, mtctx->cctxPool->totalCCtx); in ZSTDMT_initCStream_internal()
1376 mtctx->jobs[jobID].cctxPool = mtctx->cctxPool; in ZSTDMT_createCompressionJob()