467 Subj : Re: Using SIGALRM with pthread To : comp.programming.threads From : Ian Date : Thu Jul 28 2005 04:44 pm gc wrote: > > At the same time, I need to use an ALARM signal (SIGALRM) in thread A > to invoke a periodical even handler. I use the signal() function to > install the handler for SIGALRM in thread A's constructor. In the > SIGALRM handler, I also need to access some variables and data > structures from thread A. > Why not use another thread to do the wakeup? No point complicating things with signals. > What frustrates me is that, without turning on the ALARM signal, > everything goes well. Whenever I turn on the ALARM signal, I get all > kinds of werid errors related to pthread_mutexes. For instance, > segmentation fault on pthread_mutex_unlock (unlock the mutex for the > conditional variable), or sometimes thread B gets blocked on > pthread_mutex_unlock (unlock does not return), or sometimes the whole > program halts. > Do you semaphore and condition objects cope with spurious wakeups or pthread_cond_wait returning after being interrupted by a signal? Ian . 0