cooling/cooling.cc
/// Loop until dismissed by SIGTERM, monitoring the temperature and
/// child program. Only one instance should run on a host
///
Loop until dismissed by SIGTERM, monitoring the temperature and
child program. Only one instance should run on a host
Loop until dismissed by SIGTERM monitoring the temperature and child program . Only one instance should run on a host
int Cooling::run()
{
    unsigned polls=0;
    if (is_running(AppName)) {
        throw Already_running_exception();
    }
    mark_running(AppName);
    setup_sigterm_handler();
    if (m_rsked_enabled) { start_rsked(); }
    for (;;) {
        nanosleep(&m_poll_timespec,nullptr);  
        if (g_Terminate) { break; }
        if (g_ReloadReq) {
            reload_config();
            g_ReloadReq=false;
            continue;
        }
        if (m_rsked_enabled) { check_rsked(); }
        update_leds();
        check_buttons();
        control_temp();
        if (0==polls++) {       
            LOG_INFO(Lgr) << "rsked " << rsk_modename( get_status())
                          << ", temperature " << m_degc << " C";
        }
        if (polls >= m_poll_trace) { polls=0; }
        log_banner(false);
    }
    LOG_INFO(Lgr) << AppName << " exits via signal " << g_TermSignal;
    mark_ended(AppName);
    return 0;
}
int Cooling :: run ( ) { unsigned polls = 0 ; if ( is_running ( AppName ) ) { throw Already_running_exception ( ) ; } mark_running ( AppName ) ; setup_sigterm_handler ( ) ; if ( m_rsked_enabled ) { start_rsked ( ) ; } for ( ; ; ) { nanosleep ( & m_poll_timespec , nullptr ) ; if ( g_Terminate ) { break ; } if ( g_ReloadReq ) { reload_config ( ) ; g_ReloadReq = false ; continue ; } if ( m_rsked_enabled ) { check_rsked ( ) ; } update_leds ( ) ; check_buttons ( ) ; control_temp ( ) ; if ( 0 == polls ++ ) { LOG_INFO ( Lgr ) << " " << rsk_modename ( get_status ( ) ) << " " << m_degc << " " ; } if ( polls >= m_poll_trace ) { polls = 0 ; } log_banner ( false ) ; } LOG_INFO ( Lgr ) << AppName << " " << g_TermSignal ; mark_ended ( AppName ) ; return 0 ; }
Loop until dismissed by SIGTERM, monitoring the temperature and
child program.
Loop until dismissed by SIGTERM monitoring the temperature and child program .
// snooze; n.b. wakes on signal // trace