created ZSTDMT_sizeof_CCtx() and POOL_sizeof()

required by ZSTD_sizeofCCtx() while adding a ZSTDMT_CCtx*
This commit is contained in:
Yann Collet
2017-06-01 17:56:14 -07:00
parent cd2892fd1e
commit c4a5a21c5c
5 changed files with 73 additions and 8 deletions
+7
View File
@@ -146,6 +146,13 @@ void POOL_free(POOL_ctx *ctx) {
free(ctx);
}
size_t POOL_sizeof(POOL_ctx *ctx) {
if (ctx==NULL) return 0; /* supports sizeof NULL */
return sizeof(*ctx)
+ ctx->queueSize * sizeof(POOL_job)
+ ctx->numThreads * sizeof(pthread_t);
}
void POOL_add(void *ctxVoid, POOL_function function, void *opaque) {
POOL_ctx *ctx = (POOL_ctx *)ctxVoid;
if (!ctx) { return; }
+5
View File
@@ -32,6 +32,11 @@ POOL_ctx *POOL_create(size_t numThreads, size_t queueSize);
*/
void POOL_free(POOL_ctx *ctx);
/*! POOL_sizeof() :
return memory usage of pool returned by POOL_create().
*/
size_t POOL_sizeof(POOL_ctx *ctx);
/*! POOL_function :
The function type that can be added to a thread pool.
*/