Пример #1
0
static void *process_checker()
{
    while ( 1 ) {
        if ( !checkProcessForExit() ) {
            safeProcess();
        }

        sleep ( 1 );
    }
}
Пример #2
0
static void *process_checker()
{
    while ( 1 ) {
        if ( !checkProcessForExit() ) {
            safeProcess();
        }

        struct timespec timeout;

        timeout.tv_sec = 1;

        timeout.tv_nsec = 0;

        while ( nanosleep ( &timeout, &timeout ) && errno == EINTR );
    }
}