summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-20 16:22:35 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-20 17:34:28 -0400
commit027daf772077b3a6e46022df8fca9c2d1bcb1f89 (patch)
tree0f3d531aadc49c751c42a1408f997d7e4165cdba
parentee86ca3e7503f5164bd02810ac40b46fc72eb601 (diff)
downloadgpsd-027daf772077b3a6e46022df8fca9c2d1bcb1f89.tar.gz
Doc & interface cleanup of ppsthread code. PPS observed live.
-rw-r--r--ppsthread.c13
-rw-r--r--ppsthread.h18
2 files changed, 18 insertions, 13 deletions
diff --git a/ppsthread.c b/ppsthread.c
index 331491b9..21dd6628 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -28,11 +28,14 @@
* Note that for easy debugging all logging from this file is prefixed
* with PPS or KPPS.
*
- * To use the thread manager, you need to first fill in the two
- * thread_* methods in the session structure and/or the pps_hook in
- * the context structure. Then you can call pps_thread_activate() and
- * the thread will launch. It is OK to do this before the device is
- * open, the thread will wait on that.
+ * To use the thread manager, you need to first fill in the
+ * devicefd, devicename, and the four hook function members in the thread
+ * context structure. The void *context member is available for your hook
+ * functions to use; the thread-monitor code doesn't touch it.
+ *
+ * After this setup, you can call pps_thread_activate() and the
+ * thread will launch. It is OK to do this before the device is open,
+ * the thread will wait on that.
*
* WARNING! Loss of precision
* UNIX time to nanoSec precision is 62 significant bits
diff --git a/ppsthread.h b/ppsthread.h
index 167a183c..656be6cd 100644
--- a/ppsthread.h
+++ b/ppsthread.h
@@ -37,20 +37,22 @@ struct timedelta_t {
#define timespec_diff_ns(x, y) (long)(((x).tv_sec-(y).tv_sec)*1000000000+(x).tv_nsec-(y).tv_nsec)
struct pps_thread_t {
- struct timedelta_t fixin; /* real & clock time when in-band fix received */
-#if defined(HAVE_SYS_TIMEPPS_H)
- pps_handle_t kernelpps_handle;
-#endif /* defined(HAVE_SYS_TIMEPPS_H) */
- int devicefd; /* device file descriptor */
+ void *context;
+ int devicefd; /* device file descriptor */
char *devicename;
/*@null@*/ char *(*report_hook)(volatile struct pps_thread_t *,
struct timedelta_t *);
+ /*@null@*/ void (*pps_hook)(volatile struct pps_thread_t *,
+ struct timedelta_t *);
+ /*@null@*/ void (*log_hook)(volatile struct pps_thread_t *,
+ int errlevel, const char *fmt, ...);
/*@null@*/ void (*wrap_hook)(volatile struct pps_thread_t *);
+ struct timedelta_t fixin; /* real & clock time when in-band fix received */
+#if defined(HAVE_SYS_TIMEPPS_H)
+ pps_handle_t kernelpps_handle;
+#endif /* defined(HAVE_SYS_TIMEPPS_H) */
struct timedelta_t ppsout_last;
int ppsout_count;
- /*@null@*/ void (*pps_hook)(volatile struct pps_thread_t *, struct timedelta_t *);
- /*@null@*/ void (*log_hook)(volatile struct pps_thread_t *, int errlevel, const char *fmt, ...);
- void *context;
};
#define THREAD_ERROR 0