@@ -86,7 +86,7 @@ static void* POOL_thread(void* opaque) {
86
86
{ POOL_job const job = ctx -> queue [ctx -> queueHead ];
87
87
ctx -> queueHead = (ctx -> queueHead + 1 ) % ctx -> queueSize ;
88
88
ctx -> numThreadsBusy ++ ;
89
- ctx -> queueEmpty = ctx -> queueHead == ctx -> queueTail ;
89
+ ctx -> queueEmpty = ( ctx -> queueHead == ctx -> queueTail ) ;
90
90
/* Unlock the mutex, signal a pusher, and run the job */
91
91
ZSTD_pthread_cond_signal (& ctx -> queuePushCond );
92
92
ZSTD_pthread_mutex_unlock (& ctx -> queueMutex );
@@ -105,6 +105,7 @@ static void* POOL_thread(void* opaque) {
105
105
assert (0 ); /* Unreachable */
106
106
}
107
107
108
+ /* ZSTD_createThreadPool() : public access point */
108
109
POOL_ctx * ZSTD_createThreadPool (size_t numThreads ) {
109
110
return POOL_create (numThreads , 0 );
110
111
}
@@ -114,7 +115,8 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) {
114
115
}
115
116
116
117
POOL_ctx * POOL_create_advanced (size_t numThreads , size_t queueSize ,
117
- ZSTD_customMem customMem ) {
118
+ ZSTD_customMem customMem )
119
+ {
118
120
POOL_ctx * ctx ;
119
121
/* Check parameters */
120
122
if (!numThreads ) { return NULL ; }
@@ -192,7 +194,7 @@ void ZSTD_freeThreadPool (ZSTD_threadPool* pool) {
192
194
POOL_free (pool );
193
195
}
194
196
195
- size_t POOL_sizeof (POOL_ctx * ctx ) {
197
+ size_t POOL_sizeof (const POOL_ctx * ctx ) {
196
198
if (ctx == NULL ) return 0 ; /* supports sizeof NULL */
197
199
return sizeof (* ctx )
198
200
+ ctx -> queueSize * sizeof (POOL_job )
@@ -257,7 +259,8 @@ static int isQueueFull(POOL_ctx const* ctx) {
257
259
}
258
260
259
261
260
- static void POOL_add_internal (POOL_ctx * ctx , POOL_function function , void * opaque )
262
+ static void
263
+ POOL_add_internal (POOL_ctx * ctx , POOL_function function , void * opaque )
261
264
{
262
265
POOL_job const job = {function , opaque };
263
266
assert (ctx != NULL );
@@ -313,7 +316,9 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) {
313
316
return POOL_create_advanced (numThreads , queueSize , ZSTD_defaultCMem );
314
317
}
315
318
316
- POOL_ctx * POOL_create_advanced (size_t numThreads , size_t queueSize , ZSTD_customMem customMem ) {
319
+ POOL_ctx *
320
+ POOL_create_advanced (size_t numThreads , size_t queueSize , ZSTD_customMem customMem )
321
+ {
317
322
(void )numThreads ;
318
323
(void )queueSize ;
319
324
(void )customMem ;
@@ -341,7 +346,7 @@ int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) {
341
346
return 1 ;
342
347
}
343
348
344
- size_t POOL_sizeof (POOL_ctx * ctx ) {
349
+ size_t POOL_sizeof (const POOL_ctx * ctx ) {
345
350
if (ctx == NULL ) return 0 ; /* supports sizeof NULL */
346
351
assert (ctx == & g_poolCtx );
347
352
return sizeof (* ctx );
0 commit comments