Mavlink: allow to stop (WIP)

This commit is contained in:
Julian Oes
2014-02-13 19:13:10 +01:00
parent 61a849bf6b
commit 346ae5b9f4
6 changed files with 54 additions and 25 deletions
+2 -3
View File
@@ -106,8 +106,7 @@ MavlinkReceiver::MavlinkReceiver(Mavlink *parent) :
telemetry_status_pub(-1),
lat0(0),
lon0(0),
alt0(0),
thread_should_exit(false)
alt0(0)
{
}
@@ -807,7 +806,7 @@ MavlinkReceiver::receive_thread(void *arg)
ssize_t nread = 0;
while (!thread_should_exit) {
while (!_mavlink->_task_should_exit) {
if (poll(fds, 1, timeout) > 0) {
if (nread < sizeof(buf)) {
/* to avoid reading very small chunks wait for data before reading */