Changeset 2173

Show
Ignore:
Timestamp:
06/25/12 07:37:30 (12 years ago)
Author:
jwoithe
Message:

The clock values of CLOCK_MONOTONIC_RAW and CLOCK_MONOTONIC are not necessarily comparable. Since clock_nanosleep() can't be used with CLOCK_MONOTONIC_RAW - necessitating the use of CLOCK_MONOTONIC instead - this means it's not possible to use TIMER_ABSTIME with clock_nanosleep if CLOCK_MONOTONIC_RAW is the system clock source. For simplicity, disable the use of TIMER_ABSTIME unconditionally when implementing SleepUsecAbsolute?() at this stage.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libutil/SystemTimeSource.cpp

    r2172 r2173  
    8484SystemTimeSource::SleepUsecAbsolute(ffado_microsecs_t wake_at_usec) 
    8585{ 
    86 #if USE_ABSOLUTE_NANOSLEEP 
     86// If the system time is based on CLOCK_MONOTONIC_RAW we can't use 
     87// TIMER_ABSTIME because wake_at_usec will be in terms of 
     88// CLOCK_MONOTONIC_RAW while clock_nanosleep() can at best use only 
     89// CLOCK_MONOTONIC.  There is, AFAIK, no guarantee that the two are even 
     90// remotely related.  For now, resolve this problem by unconditionally 
     91// disabling the use of TIMER_ABSTIME here, regardless of the setting of 
     92// USE_ABSOLUTE_NANOSLEEP.  Jonathan Woithe, 25 June 2012. 
     93#if USE_ABSOLUTE_NANOSLEEP && 0 
    8794    // CLOCK_MONOTONIC_RAW isn't supported by clock_nanosleep() 
    8895    clockid_t clk = (clock_id==CLOCK_MONOTONIC_RAW)?CLOCK_MONOTONIC:clock_id;