Changeset 2177 for trunk

Show
Ignore:
Timestamp:
07/06/12 06:16:24 (12 years ago)
Author:
jwoithe
Message:

More work on ticket #242. sem_timedwait() can only work against CLOCK_REALTIME, so the time used to construct its absolute timeout value must be acquired from CLOCK_REALTIME regardless of the clock used by Util::SystemTimeSource?.

Files:

Legend:

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

    r2176 r2177  
    355355                m_have_read_ctr_and_clock = true; 
    356356        } 
    357 //if (m_have_read_ctr_and_clock) 
    358 //  Util::SystemTimeSource::setSource(CLOCK_REALTIME); 
    359357 
    360358        if (m_have_read_ctr_and_clock) { 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r2171 r2177  
    398398    int result; 
    399399 
    400     if (Util::SystemTimeSource::clockGettime(&ts) == -1) { 
     400    // sem_timedwait() cannot be set up to use any clock rather than  
     401    // CLOCK_REALTIME.  Therefore we get the time from CLOCK_REALTIME here. 
     402    // Doing this rather than Util::SystemTimeSource::clockGettime() doesn't 
     403    // pose a problem here because the resulting time is only used with 
     404    // sem_timedwait() to implement timeout functionality. 
     405    if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { 
    401406        debugError("clock_gettime failed\n"); 
    402407        return eAR_Error; 
  • trunk/libffado/src/libstreaming/StreamProcessorManager.cpp

    r2171 r2177  
    164164    if (m_activity_wait_timeout_nsec >= 0) { 
    165165 
    166         if (Util::SystemTimeSource::clockGettime(&ts) == -1) { 
     166        // CLOCK_REALTIME must be used because that's what sem_timedwait()  
     167        // uses.  This is safe - regardless of the clock used by 
     168        // Util::SystemTimeSource - so long as the resulting time is only 
     169        // used to implement a timeout in sem_timedwait(). 
     170        if (clock_gettime(CLOCK_REALTIME, &ts) == -1) { 
    167171            debugError("clock_gettime failed\n"); 
    168172            return eAR_Error;