git-svn: trunk@3882
Tomasz Kojm authored on 2008/06/04 03:25:44... | ... |
@@ -232,7 +232,9 @@ void thrmgr_worker_stop_wait(threadpool_t * const threadpool) |
232 | 232 |
|
233 | 233 |
/* wait for threads to exit */ |
234 | 234 |
if (threadpool->thr_alive > 0) { |
235 |
+#ifdef CL_DEBUG |
|
235 | 236 |
logg("*%u active threads: waking them and entering wait loop\n", threadpool->thr_alive); |
237 |
+#endif |
|
236 | 238 |
if (pthread_cond_broadcast(&(threadpool->pool_cond)) != 0) { |
237 | 239 |
pthread_mutex_unlock(&threadpool->pool_mutex); |
238 | 240 |
logg("!Fatal: failed in cond broadcast 'pool_cond'\n"); |
... | ... |
@@ -241,14 +243,20 @@ void thrmgr_worker_stop_wait(threadpool_t * const threadpool) |
241 | 241 |
} |
242 | 242 |
/* now, wait for the threads to exit, make 'loop' number of tries, */ |
243 | 243 |
while (threadpool->thr_alive > 0 && loop--) { |
244 |
+#ifdef CL_DEBUG |
|
244 | 245 |
logg("*%u active threads. Waiting.\n", threadpool->thr_alive); |
246 |
+#endif |
|
245 | 247 |
timeout.tv_sec = time(NULL) + (threadpool->idle_timeout/2) + 10L; |
246 | 248 |
timeout.tv_nsec = 0; |
247 | 249 |
ret_cond = pthread_cond_timedwait (&threadpool->pool_cond, &threadpool->pool_mutex, &timeout); |
248 | 250 |
if (ret_cond == ETIMEDOUT) { |
251 |
+#ifdef CL_DEBUG |
|
249 | 252 |
logg("*%u active threads. Continue to wait.\n", threadpool->thr_alive); |
253 |
+#endif |
|
250 | 254 |
} else if (ret_cond == 0) { |
255 |
+#ifdef CL_DEBUG |
|
251 | 256 |
logg("*Received signal. %u active threads.\n", threadpool->thr_alive); |
257 |
+#endif |
|
252 | 258 |
} |
253 | 259 |
} |
254 | 260 |
if (pthread_mutex_unlock(&threadpool->pool_mutex) != 0) { |
... | ... |
@@ -282,7 +290,7 @@ static void *thrmgr_worker_cleanup(void *arg) |
282 | 282 |
exit(-2); |
283 | 283 |
} |
284 | 284 |
(threadpool->thr_alive) && threadpool->thr_alive--; |
285 |
- logg("*Thread clean up, %u active threads.", threadpool->thr_alive); |
|
285 |
+ /* logg("*Thread clean up, %u active threads.", threadpool->thr_alive); */ |
|
286 | 286 |
if (threadpool->thr_alive == 0) { |
287 | 287 |
/* signal that all threads are finished */ |
288 | 288 |
pthread_cond_broadcast(&threadpool->pool_cond); |