summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2020-04-09 13:35:14 -0500
committerJason Reiss <jreiss@multitech.com>2020-04-09 13:35:14 -0500
commit9db21b62013420e1a491a1aa5d7103491ee8b5dd (patch)
treef17facafc889f7a09d48254fcde36fb96db5ed6f
parentb2a7a1fd9ddfa53f377b4eb6a6702e5c8dec052e (diff)
parentff7d1ce96caa14fd729b3045b0a8812b29180c35 (diff)
downloadpacket_forwarder_mtac_full-9db21b62013420e1a491a1aa5d7103491ee8b5dd.tar.gz
packet_forwarder_mtac_full-9db21b62013420e1a491a1aa5d7103491ee8b5dd.tar.bz2
packet_forwarder_mtac_full-9db21b62013420e1a491a1aa5d7103491ee8b5dd.zip
Merge branch 'master' of gitlab.multitech.net:lora_enterprise/packet_forwarder_mtac_full
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 5b2da71..cb467bc 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -1579,11 +1579,12 @@ int main(int argc, char** argv)
MSG("ERROR: [main] impossible to create GPS thread\n");
exit(EXIT_FAILURE);
}
- i = pthread_create( &thrid_valid, NULL, (void * (*)(void *))thread_valid, NULL);
- if (i != 0) {
- MSG("ERROR: [main] impossible to create validation thread\n");
- exit(EXIT_FAILURE);
- }
+ }
+
+ i = pthread_create( &thrid_valid, NULL, (void * (*)(void *))thread_valid, NULL);
+ if (i != 0) {
+ MSG("ERROR: [main] impossible to create validation thread\n");
+ exit(EXIT_FAILURE);
}
i = pthread_create( &thrid_spectralscan, NULL, (void * (*)(void *))thread_spectralscan, NULL);
@@ -1798,9 +1799,10 @@ int main(int argc, char** argv)
pthread_cancel(thrid_down); /* don't wait for downstream thread */
pthread_cancel(thrid_jit); /* don't wait for jit thread */
pthread_cancel(thrid_timersync); /* don't wait for timer sync thread */
+ pthread_cancel(thrid_valid); /* don't wait for validation thread */
+
if (gps_enabled == true) {
pthread_cancel(thrid_gps); /* don't wait for GPS thread */
- pthread_cancel(thrid_valid); /* don't wait for validation thread */
i = lgw_gps_disable(&gpsdata);
if (i == LGW_HAL_SUCCESS) {
@@ -1810,7 +1812,7 @@ int main(int argc, char** argv)
}
}
- pthread_join(thrid_spectralscan, NULL); /* don't wait for spec scan thread */
+ pthread_join(thrid_spectralscan, NULL); /* wait for spec scan thread */
/* if an exit signal was received, try to quit properly */
if (exit_sig) {
@@ -3372,6 +3374,10 @@ void thread_valid(void) {
last = now;
}
+
+ if (gps_enabled != true) {
+ continue;
+ }
/* calculate when the time reference was last updated */
pthread_mutex_lock(&mx_timeref);