diff options
author | Gary E. Miller <gem@rellim.com> | 2015-03-12 12:49:59 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2015-03-12 12:49:59 -0700 |
commit | cfd75178762a5b8f27c758bb97d8e58c66172c9e (patch) | |
tree | 2e7621f765d524707afdf02b35116b431801318d /libgps_shm.c | |
parent | 0fc51deea783be9a7dc272972a0141aca3bab227 (diff) | |
download | gpsd-cfd75178762a5b8f27c758bb97d8e58c66172c9e.tar.gz |
Document SHM and JSON timeout is in uSec. Fix SHM so that is true.
JSON wait was in uSec, but SHM wait was in Sec. Made both uSec
and documented three places.
Diffstat (limited to 'libgps_shm.c')
-rw-r--r-- | libgps_shm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgps_shm.c b/libgps_shm.c index 90e962c8..bc245bea 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -75,9 +75,10 @@ int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata) bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) /* check to see if new data has been written */ +/* timeout is in uSec */ { volatile struct shmexport_t *shared = (struct shmexport_t *)PRIVATE(gpsdata)->shmseg; - timestamp_t basetime = timestamp(); + timestamp_t endtime = timestamp() + (((double)timeout)/1000000);; volatile bool newdata = false; /* busy-waiting sucks, but there's not really an alternative */ @@ -90,7 +91,7 @@ bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) memory_barrier(); if (bookend1 == bookend2 && bookend1 > PRIVATE(gpsdata)->tick) newdata = true; - if (newdata || (timestamp() - basetime >= (double)timeout)) + if (newdata || (timestamp() >= endtime)) break; } |