Set CaptureThread::thread to null after thread is released.

Was having a timing problem where ISR was still trying to signal thread after thread was nulled.
This commit is contained in:
Jared Boone 2016-04-27 10:13:50 -07:00
parent 4a348e2c6c
commit ca5dadab93

View File

@ -85,13 +85,11 @@ public:
}
~CaptureThread() {
const auto thread_tmp = thread;
if( thread_tmp ) {
if( thread ) {
chThdTerminate(thread);
chEvtSignal(thread, EVT_MASK_CAPTURE_THREAD);
const auto success = chThdWait(thread);
thread = nullptr;
chThdTerminate(thread_tmp);
chEvtSignal(thread_tmp, EVT_MASK_CAPTURE_THREAD);
const auto success = chThdWait(thread_tmp);
if( !success ) {
led_tx.on();