[Bug 1727] New: Reading of timestamps is not atomic in general

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Dec 21 10:52:19 UTC 2010


https://www.rtems.org/bugzilla/show_bug.cgi?id=1727

           Summary: Reading of timestamps is not atomic in general
           Product: RTEMS
           Version: HEAD
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: cpukit
        AssignedTo: joel.sherrill at oarcorp.com
        ReportedBy: sebastian.huber at embedded-brains.de


We use

int64_t

or

struct timespec {
  long tv_nsec;
  long tv_sec;
};

for timestamps in the Score (Timestamp_Control).  The read of such values is in
general not atomic.  We should provide a function

void _Timestamp_Get( Timestamp_Control *val )

for atomic reads of timestamps.  We can use interrupt enable/disable for this,
or exploit the monotonic property of timestamps:

do {
  s0 = val->tv_sec;
  ns0 = val->tv_nsec;
  RTEMS_COMPILER_MEMORY_BARRIER();
  s1 = val->tv_sec;
} while (s0 != s1);

I prefer the interrupt enable/disable variant.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list