rsked/vlcplayer.cc
/// Enforce sleep for usecs microseconds, even if interrupted by
/// signals.  Exception: If there was a problem copying information
/// from user space, it will exit prematurely. Values of usecs
/// less than or equal to 0 will make the function return immediately.
///
Enforce sleep for usecs microseconds, even if interrupted by
signals.  Exception: If there was a problem copying information
from user space, it will exit prematurely. Values of usecs
less than or equal to 0 will make the function return immediately.
Enforce sleep for usecs microseconds even if interrupted by signals . Exception : If there was a problem copying information from user space it will exit prematurely . Values of usecs less than or equal to 0 will make the function return immediately .
static void really_sleep( long usecs )
{
    if (usecs <= 0) {
        return;
    }
    time_t secs = usecs / 1'000'000;
    long nsecs  = 1000 * (usecs - secs*1'000'000);
    struct timespec rem { secs, nsecs };
    errno = 0;
    for (;;) {
        struct timespec req = rem;
        int rc = nanosleep( &req, &rem );
        if (0==rc) {
            return;   
        }
        if (errno != EINTR) {
            break;
        }
    }
}
static void really_sleep ( long usecs ) { if ( usecs <= 0 ) { return ; } time_t secs = usecs / 1'000'000 ; long nsecs = 1000 * ( usecs - secs * 1'000'000 ) ; struct timespec rem { secs , nsecs } ; errno = 0 ; for ( ; ; ) { struct timespec req = rem ; int rc = nanosleep ( & req , & rem ) ; if ( 0 == rc ) { return ; } if ( errno != EINTR ) { break ; } } }
Enforce sleep for usecs microseconds, even if interrupted by
signals.
Enforce sleep for usecs microseconds even if interrupted by signals .
// finished the entire interval