fix sigtimedwait on OS X and OpenBSD (forgot sigwait call)
OpenBSD needs -lpthread for sigwait
fix sigtimedwait on NetBSD 5.1
unbreak OS X
silence erroneous GCC warning on NetBSD 6.1