diff options
author | Thomas Tsou <ttsou@vt.edu> | 2012-03-17 15:02:32 -0400 |
---|---|---|
committer | Alexander Chemeris <Alexander.Chemeris@gmail.com> | 2013-06-24 01:51:02 +0400 |
commit | 5f13377b83bc5bfafaf6b150a4b507f190cee585 (patch) | |
tree | 9e64451a2bd9c399e62dc9da45f32cce571d6fc3 /Transceiver52M/DriveLoop.h | |
parent | a6ca73ca67b2a66f46be4bafd5ebf397a3c0a2af (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.h | 5 |
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(); } |