mavlink/qgroundcontrol — pull request #717 by DonLakeFlyer (2014-06-15 22:36:46+00:00)
Title: Fix TCPLink for threading changes and update unit test

This ended up being fairly involved because the new threading model makes it difficult to write a single method which needs to verify things across the thread boundaries. Normally signaling takes care of all of this for you, queuing signals across threads as needed. But when writing a unit test, you need to write a single method which begins and ends making it tricky.

I also ended up having to move the TCPServer to it's own thread to get things to work. In doing that I changed it to be a simple loopback server. This allows for link testing for both reads and writes.

The unit test was also indicating issues with calls being made to the link from the wrong thread. Windows seems to be more anal about all of this. I had to change various things in TCPLink to get it to work. I have a suspicion that UDPLink may also be broken on Windows in the same way with the recent threading changes. I'll see if I can figure out a way to write a unit test for that to make sure it is fully functional on all OS.