Use the self pipe trick for ThSig rather than sigwait.

PyTango has an issue where the ThSig breaks if numpy spawns threads before tango has a chance to setup signal masks (pytango#602 (closed)). I have realised that the issue is with how ThSig works using sigwait().

ThSig is using sigwait() to synchronously wait for signals. The issue is that sigwait() waits for a signal to be pending, which means that it has arrived but not been delivered to a thread. The issue is that when the numpy threads exist without having the signal masked the signal never becomes pending as it is delivered straight to them.

What does the signal do when it is delivered to the numpy threads? Runs the default handler because that is the "disposition" the process has to the signal. Importantly though, the signal disposition is process wide and invoking a signal handler is a possible disposition. So, if instead of using sigwait(), cppTangoThSig` uses a signal handler, even if the numpy thread catches it, the signal handler will run.

I think we can simulate the same behaviour as sigwait() using the "self pipe trick" and select(). This means we have the signal handler write to one end of a pipe and ThSig can wait using select() on the read end of the pipe.