File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ static void bleLoop()
162162}
163163
164164static rtos::EventFlags bleEventFlags;
165- static rtos::Thread bleLoopThread;
165+ static rtos::Thread* bleLoopThread = NULL ;
166166
167167
168168HCICordioTransportClass::HCICordioTransportClass () :
@@ -186,7 +186,10 @@ int HCICordioTransportClass::begin()
186186 CordioHCIHook::getDriver ().initialize ();
187187 CordioHCIHook::getDriver ().start_reset_sequence ();
188188
189- bleLoopThread.start (bleLoop);
189+ if (bleLoopThread == NULL ) {
190+ bleLoopThread = new rtos::Thread ();
191+ bleLoopThread->start (bleLoop);
192+ }
190193
191194 CordioHCIHook::setDataReceivedHandler (HCICordioTransportClass::onDataReceived);
192195
@@ -197,7 +200,11 @@ int HCICordioTransportClass::begin()
197200
198201void HCICordioTransportClass::end ()
199202{
200- bleLoopThread.terminate ();
203+ if (bleLoopThread != NULL ) {
204+ bleLoopThread->terminate ();
205+ delete bleLoopThread;
206+ bleLoopThread = NULL ;
207+ }
201208
202209 CordioHCIHook::getDriver ().terminate ();
203210
You can’t perform that action at this time.
0 commit comments