For a PR
Fork of ublox-at-cellular-interface by
Diff: UbloxATCellularInterface.cpp
- Revision:
- 14:5f55453ef38f
- Parent:
- 13:39264b492ce7
diff -r 39264b492ce7 -r 5f55453ef38f UbloxATCellularInterface.cpp --- a/UbloxATCellularInterface.cpp Wed Jan 10 09:44:24 2018 +0000 +++ b/UbloxATCellularInterface.cpp Thu Mar 01 21:32:25 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(); @@ -938,6 +938,8 @@ _uname = NULL; _pwd = NULL; _connection_status_cb = NULL; + + _run_event_thread = true; // Initialise sockets storage memset(_sockets, 0, sizeof(_sockets)); @@ -969,6 +971,9 @@ // Destructor. UbloxATCellularInterface::~UbloxATCellularInterface() { + _run_event_thread = false; + event_thread.join(); + // Free _ip if it was ever allocated free(_ip); }