! POOL_join() : Shutdown the queue, wake any sleeping threads, and join all of the threads. */
| 163 | Shutdown the queue, wake any sleeping threads, and join all of the threads. |
| 164 | */ |
| 165 | static void POOL_join(POOL_ctx* ctx) { |
| 166 | /* Shut down the queue */ |
| 167 | ZSTD_pthread_mutex_lock(&ctx->queueMutex); |
| 168 | ctx->shutdown = 1; |
| 169 | ZSTD_pthread_mutex_unlock(&ctx->queueMutex); |
| 170 | /* Wake up sleeping threads */ |
| 171 | ZSTD_pthread_cond_broadcast(&ctx->queuePushCond); |
| 172 | ZSTD_pthread_cond_broadcast(&ctx->queuePopCond); |
| 173 | /* Join all of the threads */ |
| 174 | { size_t i; |
| 175 | for (i = 0; i < ctx->threadCapacity; ++i) { |
| 176 | ZSTD_pthread_join(ctx->threads[i], NULL); /* note : could fail */ |
| 177 | } } |
| 178 | } |
| 179 | |
| 180 | void POOL_free(POOL_ctx *ctx) { |
| 181 | if (!ctx) { return; } |
no test coverage detected