/* This function will temporarily replace the signal mask of the calling thread with the mask given and then suspends the thread until delivery of an expected signal or a signal whose action is to terminate a process.  */
int sigsuspend(const sigset_t *set)
/* This function will temporarily replace the signal mask of the calling thread with the mask given and then suspends the thread until delivery of an expected signal or a signal whose action is to terminate a process.  */
int sigsuspend(const sigset_t *set)
{
    int ret  = 0;
    sigset_t origin_set;
    sigset_t suspend_set;
    siginfo_t info;
    sigpending(&origin_set);
    sigprocmask(SIG_BLOCK, set, RT_NULL);
    sigpending(&suspend_set);
    ret = rt_signal_wait(&suspend_set, &info, RT_WAITING_FOREVER);
    sigprocmask(SIG_UNBLOCK, (sigset_t *)0xffffUL, RT_NULL);
    sigprocmask(SIG_BLOCK, &origin_set, RT_NULL);
    return ret;
}