Fork of ublox-at-cellular-interface to add LARA-R2 support

Dependents:  

Fork of ublox-at-cellular-interface by u-blox

Revision:
14:e7dcf3388403
Parent:
13:39264b492ce7
Child:
15:8cc9a80ac0ad
--- a/UbloxATCellularInterface.cpp	Wed Jan 10 09:44:24 2018 +0000
+++ b/UbloxATCellularInterface.cpp	Fri Mar 02 13:28:32 2018 +0000
@@ -40,7 +40,7 @@
     fhs.fh = _fh;
     fhs.events = POLLIN;
 
-    while (true) {
+    while (_run_event_thread) {
         count = poll(&fhs, 1, 1000);
         if (count > 0 && (fhs.revents & POLLIN)) {
             LOCK();
@@ -934,6 +934,7 @@
     _sim_pin_check_change_pending_enabled_value = false;
     _sim_pin_change_pending = false;
     _sim_pin_change_pending_new_pin_value = NULL;
+    _run_event_thread = true;
     _apn = NULL;
     _uname = NULL;
     _pwd = NULL;
@@ -969,6 +970,10 @@
 // Destructor.
 UbloxATCellularInterface::~UbloxATCellularInterface()
 {
+    // Let the event thread shut down tidily
+    _run_event_thread = false;
+    event_thread.join();
+    
     // Free _ip if it was ever allocated
     free(_ip);
 }