summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-04-01 04:13:59 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-04-01 04:13:59 -0400
commit27421a355f42c6303cae74a861a86f5c96d29d18 (patch)
tree4dd940e46fd5397856139ca14d0be96fcb82b3a1
parentb72e52abcec878350f5c522d243a643cb0ebcc92 (diff)
downloadgpsd-27421a355f42c6303cae74a861a86f5c96d29d18.tar.gz
Further thread-monitor interface simplification.
Remove the wrap hook. The only thing it was doing was closing the chrony fd. which can be done just as cleanly by whatever calls the pps_thread_deactivate() function.
-rw-r--r--ppsthread.c2
-rw-r--r--ppsthread.h5
-rw-r--r--timehint.c10
3 files changed, 3 insertions, 14 deletions
diff --git a/ppsthread.c b/ppsthread.c
index d3d9fd64..df46c64f 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -1177,8 +1177,6 @@ static void *gpsd_ppsmonitor(void *arg)
(void)time_pps_destroy(inner_context.kernelpps_handle);
}
#endif
- if (thread_context->wrap_hook != NULL)
- thread_context->wrap_hook(thread_context);
thread_context->log_hook(thread_context, THREAD_PROG,
"PPS:%s gpsd_ppsmonitor exited.\n",
thread_context->devicename);
diff --git a/ppsthread.h b/ppsthread.h
index 5c95e72b..6dc18964 100644
--- a/ppsthread.h
+++ b/ppsthread.h
@@ -31,9 +31,7 @@ struct timedelta_t {
* two functions are for.
*
* The report hook is called when each PPS event is recognized. The log
- * hook is called to log error and status indications from the thread. The
- * wrap hook is called when the thread terminates as the result of a
- * deactivate call.
+ * hook is called to log error and status indications from the thread.
*/
struct pps_thread_t {
void *context; /* PPS thread code leaves this alone */
@@ -43,7 +41,6 @@ struct pps_thread_t {
struct timedelta_t *);
void (*log_hook)(volatile struct pps_thread_t *,
int errlevel, const char *fmt, ...);
- void (*wrap_hook)(volatile struct pps_thread_t *);
struct timedelta_t fix_in; /* real & clock time when in-band fix received */
struct timedelta_t pps_out; /* real & clock time of last PPS event */
int ppsout_count;
diff --git a/timehint.c b/timehint.c
index 0a6ebd69..e1921c3f 100644
--- a/timehint.c
+++ b/timehint.c
@@ -344,13 +344,6 @@ static void chrony_send(struct gps_device_t *session, struct timedelta_t *td)
(void)send(session->chronyfd, &sample, sizeof (sample), 0);
}
-static void wrap_hook(volatile struct pps_thread_t *pps_thread)
-{
- struct gps_device_t *session = (struct gps_device_t *)pps_thread->context;
- if (session->chronyfd != -1)
- (void)close(session->chronyfd);
-}
-
static char *report_hook(volatile struct pps_thread_t *pps_thread,
struct timedelta_t *td)
/* ship the time of a PPS event to ntpd and/or chrony */
@@ -399,6 +392,8 @@ void ntpshm_link_deactivate(struct gps_device_t *session)
#if defined(PPS_ENABLE)
if (session->shm_pps != NULL) {
pps_thread_deactivate(&session->pps_thread);
+ if (session->chronyfd != -1)
+ (void)close(session->chronyfd);
(void)ntpshm_free(session->context, session->shm_pps);
session->shm_pps = NULL;
}
@@ -437,7 +432,6 @@ void ntpshm_link_activate(struct gps_device_t *session)
} else {
init_hook(session);
session->pps_thread.report_hook = report_hook;
- session->pps_thread.wrap_hook = wrap_hook;
pps_thread_activate(&session->pps_thread);
}
#endif /* PPS_ENABLE */