/* This function will suspends execution of the calling thread until one of the signals in the given set is pending. If none of the signals specified are pending, it will wait for the specified time interval.  */
int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
/* This function will suspends execution of the calling thread until one of the signals in the given set is pending. If none of the signals specified are pending, it will wait for the specified time interval.  */
int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout)
{
    int ret  = 0;
    int tick = RT_WAITING_FOREVER;
    if (timeout)
    {
        tick = timeout->tv_sec * RT_TICK_PER_SECOND + timeout->tv_nsec * RT_TICK_PER_SECOND / NANOSECOND_PER_SECOND;
    }
    ret = rt_signal_wait(set, info, tick);
    if (ret == 0) return 0;
    errno = ret;
    return -1;
}