252 time_t end = t + timeout; |
252 time_t end = t + timeout; |
253 int i = 0; |
253 int i = 0; |
254 while(t < end || i < 2) { |
254 while(t < end || i < 2) { |
255 uint32_t num_threads = pool->num_threads; |
255 uint32_t num_threads = pool->num_threads; |
256 if(num_threads == 0) { |
256 if(num_threads == 0) { |
|
257 // it's possible that we send too many kill jobs, cleanup the queue |
|
258 while(pool->queue) { |
|
259 pool_queue_t *q = pool->queue->next; |
|
260 free(pool->queue); |
|
261 pool->queue = q; |
|
262 } |
257 break; |
263 break; |
258 } |
264 } |
259 |
265 |
260 log_ereport(LOG_VERBOSE, "threadpool_shutdown: wait for thread shutdown: %u threads still running", (unsigned int)num_threads); |
266 log_ereport(LOG_VERBOSE, "threadpool_shutdown: wait for thread shutdown: %u threads still running", (unsigned int)num_threads); |
261 sleep(5); |
267 sleep(5); |