#1727 closed defect (wontfix)

Reading of timestamps is not atomic in general

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

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.

Change History (3)

comment:1 Changed on 12/21/10 at 13:25:33 by Sebastian Huber

Replying to comment:1:

There is currently no _Timestamp_Get method. Are you proposing to add one that
is atomic?

Yes, we have no _Timestamp_Get() method currently, and we need one.

If so, there will also need to be a _Timestamp_Get_unprotected.

Ok.

comment:2 Changed on 11/24/14 at 18:58:28 by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:3 Changed on 12/18/14 at 09:23:06 by Sebastian Huber

Description: modified (diff)
Resolution: wontfix
Status: newclosed

In _TOD_Get_with_nanoseconds() interrupts are disabled for the snapshot. No plans to add a general _Timestamp_Get(). The timestamp implementation should be replaced with FreeBSD timecounters.

Note: See TracTickets for help on using tickets.