clamd/thrmgr.c: move some msgs to debug (bb#1028)

git-svn: trunk@3882
remotes/push_mirror/metadata
Tomasz Kojm 17 years ago
parent aa87b23c8c
commit 22e4ec878a
  1. 4
      ChangeLog
  2. 10
      clamd/thrmgr.c

@ -1,3 +1,7 @@
Tue Jun 3 19:41:34 CEST 2008 (tk)
----------------------------------
* clamd/thrmgr.c: move some msgs to debug (bb#1028)
Mon Jun 2 20:50:10 CEST 2008 (acab)
------------------------------------
* libclamav/ole2_extract.c: comment removed

@ -232,7 +232,9 @@ void thrmgr_worker_stop_wait(threadpool_t * const threadpool)
/* wait for threads to exit */
if (threadpool->thr_alive > 0) {
#ifdef CL_DEBUG
logg("*%u active threads: waking them and entering wait loop\n", threadpool->thr_alive);
#endif
if (pthread_cond_broadcast(&(threadpool->pool_cond)) != 0) {
pthread_mutex_unlock(&threadpool->pool_mutex);
logg("!Fatal: failed in cond broadcast 'pool_cond'\n");
@ -241,14 +243,20 @@ void thrmgr_worker_stop_wait(threadpool_t * const threadpool)
}
/* now, wait for the threads to exit, make 'loop' number of tries, */
while (threadpool->thr_alive > 0 && loop--) {
#ifdef CL_DEBUG
logg("*%u active threads. Waiting.\n", threadpool->thr_alive);
#endif
timeout.tv_sec = time(NULL) + (threadpool->idle_timeout/2) + 10L;
timeout.tv_nsec = 0;
ret_cond = pthread_cond_timedwait (&threadpool->pool_cond, &threadpool->pool_mutex, &timeout);
if (ret_cond == ETIMEDOUT) {
#ifdef CL_DEBUG
logg("*%u active threads. Continue to wait.\n", threadpool->thr_alive);
#endif
} else if (ret_cond == 0) {
#ifdef CL_DEBUG
logg("*Received signal. %u active threads.\n", threadpool->thr_alive);
#endif
}
}
if (pthread_mutex_unlock(&threadpool->pool_mutex) != 0) {
@ -282,7 +290,7 @@ static void *thrmgr_worker_cleanup(void *arg)
exit(-2);
}
(threadpool->thr_alive) && threadpool->thr_alive--;
logg("*Thread clean up, %u active threads.", threadpool->thr_alive);
/* logg("*Thread clean up, %u active threads.", threadpool->thr_alive); */
if (threadpool->thr_alive == 0) {
/* signal that all threads are finished */
pthread_cond_broadcast(&threadpool->pool_cond);

Loading…
Cancel
Save