[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[no subject]



Hello,

I'm working with Linux pthreads, from the glibc 2.2.3.

The problem occurs when I try to shut down my aplication controlled by receiving signal SIGTERM. The root thread receives the signal and makes a pthread_cancel() to all threads and waits with pthread_join() for cancellation. But a thread waiting on pthread_cond_timedwait() doesn`t cancel and so pthread_join() doesn`t return.
Could anyone explain this behaviour to me?

Code snippets:
root-task
...
while (gotSig == 0)
{	
  sigwait (&SigMask, &SigNum);
  if ((SigNum == SIGTERM) || (SigNum == SIGKILL)) 
  gotSig= 1;
}
...
pthread_cancel ( task1_id );
pthread_join ( task1_id, (void **)NULL )
...

task1
...
pthread_mutex_lock(&mutex);
pthread_cond_timedwait(&cond,&mutex,&timeout)
pthread_mutex_unlock(&mutex);
...


Thanx for your answers,

Ralf






Reply to: