@@ -86,7 +86,7 @@ static void* POOL_thread(void* opaque) {
8686 { POOL_job const job = ctx -> queue [ctx -> queueHead ];
8787 ctx -> queueHead = (ctx -> queueHead + 1 ) % ctx -> queueSize ;
8888 ctx -> numThreadsBusy ++ ;
89- ctx -> queueEmpty = ctx -> queueHead == ctx -> queueTail ;
89+ ctx -> queueEmpty = ( ctx -> queueHead == ctx -> queueTail ) ;
9090 /* Unlock the mutex, signal a pusher, and run the job */
9191 ZSTD_pthread_cond_signal (& ctx -> queuePushCond );
9292 ZSTD_pthread_mutex_unlock (& ctx -> queueMutex );
@@ -105,6 +105,7 @@ static void* POOL_thread(void* opaque) {
105105 assert (0 ); /* Unreachable */
106106}
107107
108+ /* ZSTD_createThreadPool() : public access point */
108109POOL_ctx * ZSTD_createThreadPool (size_t numThreads ) {
109110 return POOL_create (numThreads , 0 );
110111}
@@ -114,7 +115,8 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) {
114115}
115116
116117POOL_ctx * POOL_create_advanced (size_t numThreads , size_t queueSize ,
117- ZSTD_customMem customMem ) {
118+ ZSTD_customMem customMem )
119+ {
118120 POOL_ctx * ctx ;
119121 /* Check parameters */
120122 if (!numThreads ) { return NULL ; }
@@ -192,7 +194,7 @@ void ZSTD_freeThreadPool (ZSTD_threadPool* pool) {
192194 POOL_free (pool );
193195}
194196
195- size_t POOL_sizeof (POOL_ctx * ctx ) {
197+ size_t POOL_sizeof (const POOL_ctx * ctx ) {
196198 if (ctx == NULL ) return 0 ; /* supports sizeof NULL */
197199 return sizeof (* ctx )
198200 + ctx -> queueSize * sizeof (POOL_job )
@@ -257,7 +259,8 @@ static int isQueueFull(POOL_ctx const* ctx) {
257259}
258260
259261
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 )
261264{
262265 POOL_job const job = {function , opaque };
263266 assert (ctx != NULL );
@@ -313,7 +316,9 @@ POOL_ctx* POOL_create(size_t numThreads, size_t queueSize) {
313316 return POOL_create_advanced (numThreads , queueSize , ZSTD_defaultCMem );
314317}
315318
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+ {
317322 (void )numThreads ;
318323 (void )queueSize ;
319324 (void )customMem ;
@@ -341,7 +346,7 @@ int POOL_tryAdd(POOL_ctx* ctx, POOL_function function, void* opaque) {
341346 return 1 ;
342347}
343348
344- size_t POOL_sizeof (POOL_ctx * ctx ) {
349+ size_t POOL_sizeof (const POOL_ctx * ctx ) {
345350 if (ctx == NULL ) return 0 ; /* supports sizeof NULL */
346351 assert (ctx == & g_poolCtx );
347352 return sizeof (* ctx );
0 commit comments