diff options
| author | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-07-14 14:51:28 +0000 |
|---|---|---|
| committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-07-14 14:51:28 +0000 |
| commit | affe9eaf7807e0a5c3aa99d79dece91c3bbc3854 (patch) | |
| tree | 86f382469abb446221bb5f590e38193c99fc4214 /lib/common/pool.c | |
| parent | ffcbc2d7ba03067492045e4cbead519a3b3c27ef (diff) | |
Diffstat (limited to 'lib/common/pool.c')
| -rw-r--r-- | lib/common/pool.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/common/pool.c b/lib/common/pool.c index e439fe1b0dd6..749fa4f2f7b4 100644 --- a/lib/common/pool.c +++ b/lib/common/pool.c @@ -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; } @@ -191,4 +198,9 @@ void POOL_add(void *ctx, POOL_function function, void *opaque) { function(opaque); } +size_t POOL_sizeof(POOL_ctx *ctx) { + if (ctx==NULL) return 0; /* supports sizeof NULL */ + return sizeof(*ctx); +} + #endif /* ZSTD_MULTITHREAD */ |
