/* This function will suspend execution of the calling thread until one of the specified signal becomes pending and return the signal number.  */
int sigwait(const sigset_t *set, int *sig)
/* This function will suspend execution of the calling thread until one of the specified signal becomes pending and return the signal number.  */
int sigwait(const sigset_t *set, int *sig)
{
    siginfo_t si;
    if (sigtimedwait(set, &si, 0) < 0)
        return -1;
    *sig = si.si_signo;
    return 0;
}