diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-11-05 10:24:41 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-11-05 10:24:41 -0500 |
commit | 9b46d666d380770356bc1bcc0ef19ae453a2702d (patch) | |
tree | d7eef579176fcb010586cf8c9190dab412ffbed2 /ntpshm.c | |
parent | 18358ea6480ee6d952e8074f9dc1d0bff0745229 (diff) | |
download | gpsd-9b46d666d380770356bc1bcc0ef19ae453a2702d.tar.gz |
Insert memory barriers where requested, since we actually have them.
Diffstat (limited to 'ntpshm.c')
-rw-r--r-- | ntpshm.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -264,8 +264,12 @@ int ntpshm_put(struct gps_device_t *session, double fixtime, double fudge) */ shmTime->valid = 0; shmTime->count++; - /* FIXME need a memory barrier here to prevent write reordering by - * the compiler or CPU cache */ + + /* + * We need a memory barrier here to prevent write reordering by + * the compiler or CPU cache + */ + barrier(); shmTime->clockTimeStampSec = (time_t) seconds; shmTime->clockTimeStampUSec = (int)microseconds; shmTime->clockTimeStampNSec = (unsigned)(microseconds*1000); @@ -278,8 +282,8 @@ int ntpshm_put(struct gps_device_t *session, double fixtime, double fudge) * Any NMEA will be about -1 or -2. * Garmin GPS-18/USB is around -6 or -7. */ - /* FIXME need a memory barrier here to prevent write reordering by - * the compiler or CPU cache */ + barrier(); + shmTime->count++; shmTime->valid = 1; |