summaryrefslogtreecommitdiff
path: root/ntpshm.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-11-05 10:24:41 -0500
committerEric S. Raymond <esr@thyrsus.com>2013-11-05 10:24:41 -0500
commit9b46d666d380770356bc1bcc0ef19ae453a2702d (patch)
treed7eef579176fcb010586cf8c9190dab412ffbed2 /ntpshm.c
parent18358ea6480ee6d952e8074f9dc1d0bff0745229 (diff)
downloadgpsd-9b46d666d380770356bc1bcc0ef19ae453a2702d.tar.gz
Insert memory barriers where requested, since we actually have them.
Diffstat (limited to 'ntpshm.c')
-rw-r--r--ntpshm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ntpshm.c b/ntpshm.c
index abc59082..e9842555 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -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;