use sigtimedwait instead of pthread_cond_timedwait 

pthread mutexes should not be used inside signal handlers