aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/DriveLoop.h
diff options
context:
space:
mode:
authorThomas Tsou <ttsou@vt.edu>2012-03-17 15:02:32 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-06-24 01:51:02 +0400
commit5f13377b83bc5bfafaf6b150a4b507f190cee585 (patch)
tree9e64451a2bd9c399e62dc9da45f32cce571d6fc3 /Transceiver52M/DriveLoop.h
parenta6ca73ca67b2a66f46be4bafd5ebf397a3c0a2af (diff)
multi-arfcn, trx: handle thread exiting on shutdown
Previous approach was to allow stack unwinding to take care shutdown and thread ending, which was unpredictable and occasionally segfault. Attempt to shutdown more gracefully. There are thread cancellation points in the transceiver code using pthread_testcancel(), but the thread abstraction library does not allow direct access to the pthread variables. This prevents thread shutdown through pthread_cancel(). To get around this, use boolean status values in the receive socket service loops and main drive loop. The socket read calls will block indefinitly, so shutdown may cause the socket implementation to throw a SocketError exception. Use of timeout values with reads does not seem to work correctly or reliably, so catch the exception and ignore if it occurs on shutdown. The following error may appear as the socket is shutdown while the Transceiver is blocking on read(). DatagramSocket::read() failed: Bad file descriptor So be it; the API doesn't allow us to do any more. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
Diffstat (limited to 'Transceiver52M/DriveLoop.h')
-rw-r--r--Transceiver52M/DriveLoop.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Transceiver52M/DriveLoop.h b/Transceiver52M/DriveLoop.h
index 8c58296..df54ef7 100644
--- a/Transceiver52M/DriveLoop.h
+++ b/Transceiver52M/DriveLoop.h
@@ -172,6 +172,11 @@ protected:
friend void *RadioDriveLoopAdapter(DriveLoop *);
+ void reset();
+
+ /** return drive loop status */
+ bool on() { return mOn; }
+
/** set priority on current thread */
void setPriority() { mRadioInterface->setPriority(); }