diff --git a/src/utility/HCICordioTransport.cpp b/src/utility/HCICordioTransport.cpp index 1de5b4ce..15f0e128 100644 --- a/src/utility/HCICordioTransport.cpp +++ b/src/utility/HCICordioTransport.cpp @@ -162,7 +162,7 @@ static void bleLoop() } static rtos::EventFlags bleEventFlags; -static rtos::Thread bleLoopThread; +static rtos::Thread* bleLoopThread = NULL; HCICordioTransportClass::HCICordioTransportClass() : @@ -186,7 +186,10 @@ int HCICordioTransportClass::begin() CordioHCIHook::getDriver().initialize(); CordioHCIHook::getDriver().start_reset_sequence(); - bleLoopThread.start(bleLoop); + if (bleLoopThread == NULL) { + bleLoopThread = new rtos::Thread(); + bleLoopThread->start(bleLoop); + } CordioHCIHook::setDataReceivedHandler(HCICordioTransportClass::onDataReceived); @@ -197,7 +200,11 @@ int HCICordioTransportClass::begin() void HCICordioTransportClass::end() { - bleLoopThread.terminate(); + if (bleLoopThread != NULL) { + bleLoopThread->terminate(); + delete bleLoopThread; + bleLoopThread = NULL; + } CordioHCIHook::getDriver().terminate();
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: