use sigtimedwait instead of pthread_cond_timedwait

pthread mutexes should not be used inside signal handlers
Merge pull request #4 from a-richardson/master

use sigtimedwait instead of pthread_cond_timedwait