Changeset 2179

Show
Ignore:
Timestamp:
07/09/12 06:23:59 (8 years ago)
Author:
jwoithe
Message:

Fix 'insufficient wrapping' warnings which could occur during startup due to uninitialised shadow variables. Whether this had anything to do with intermittant startup failures observed from time to time remains to be seen.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/CycleTimerHelper.cpp

    r1763 r2179  
    356356        Util::SystemTimeSource::SleepUsecAbsolute(m_sleep_until); 
    357357        debugOutput( DEBUG_LEVEL_ULTRA_VERBOSE, " (%p) back...\n", this); 
     358    } else { 
     359        // Since getCycleTimerTicks() is called below, 
     360        // m_shadow_vars[m_current_shadow_idx] must contain valid data.  On 
     361        // the first run through, however, it won't because the contents of 
     362        // m_shadow_vars[] are only set later on in this function.  Thus 
     363        // set up some vaguely realistic values to prevent unnecessary 
     364        // delays when reading the cycle timer for the first time. 
     365        struct compute_vars new_vars; 
     366        new_vars.ticks = (uint64_t)(m_current_time_ticks); 
     367        new_vars.usecs = (uint64_t)m_current_time_usecs; 
     368        new_vars.rate = getRate(); 
     369        m_shadow_vars[0] = new_vars; 
    358370    } 
    359371