Пример #1
0
void datalink_module::loop(void)
{
    boost::posix_time::time_duration interval_10Hz(boost::posix_time::milliseconds(1000 / 10));
    boost::posix_time::ptime timer = boost::posix_time::microsec_clock::local_time() + interval_10Hz;

    while(thread_running)
    {
        send_messages();

        boost::this_thread::sleep(timer - boost::posix_time::microsec_clock::local_time());
        timer += interval_10Hz; // update timer
    }

}
Пример #2
0
void cGPS::loop(void)
{
    boost::posix_time::time_duration interval_10Hz(boost::posix_time::milliseconds(1000 / 10));
    boost::posix_time::ptime timer = boost::posix_time::microsec_clock::local_time() + interval_10Hz;

    while(thread_running)
    {
        AP_GPS_MTK16::update();

        if (AP_GPS_MTK16::new_data)
        {
            new_data = 0;
            signal_newdata();
        }
        boost::this_thread::sleep(timer - boost::posix_time::microsec_clock::local_time());
        timer += interval_10Hz; // update timer
    }
}