unix: workaround broken pthread_sigmask on Android

Redefine all references of pthread_sigmask to sigprocmask in order
to workaround broken behaviour of pthread_sigmask on Android
versions <4.1. See:

* https://android.googlesource.com/platform/bionic/+/9bf330b5
* https://code.google.com/p/android/issues/detail?id=15337
Try pthread_sigmask before fallback to sigprocmask