File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
features/FEATURE_BLE/source Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 17
17
#include < stdio.h>
18
18
#include " ble/BLE.h"
19
19
#include " ble/BLEInstanceBase.h"
20
+ #include " platform/mbed_critical.h"
20
21
21
22
#if defined(TARGET_OTA_ENABLED)
22
23
#include " ble/services/DFUService.h"
@@ -299,16 +300,19 @@ void BLE::waitForEvent(void)
299
300
300
301
void BLE::processEvents ()
301
302
{
303
+ core_util_critical_section_enter ();
302
304
if (event_signaled == false ) {
305
+ core_util_critical_section_exit ();
303
306
return ;
304
307
}
305
308
309
+ event_signaled = false ;
310
+ core_util_critical_section_exit ();
311
+
306
312
if (!transport) {
307
313
MBED_ERROR (MBED_MAKE_ERROR (MBED_MODULE_BLE, MBED_ERROR_CODE_BLE_BACKEND_NOT_INITIALIZED), " bad handle to underlying transport" );
308
314
}
309
315
310
- event_signaled = false ;
311
-
312
316
transport->processEvents ();
313
317
}
314
318
@@ -328,11 +332,14 @@ void BLE::onEventsToProcess(const BLE::OnEventsToProcessCallback_t& callback)
328
332
329
333
void BLE::signalEventsToProcess ()
330
334
{
335
+ core_util_critical_section_enter ();
331
336
if (event_signaled == true ) {
337
+ core_util_critical_section_exit ();
332
338
return ;
333
339
}
334
340
335
341
event_signaled = true ;
342
+ core_util_critical_section_exit ();
336
343
337
344
if (whenEventsToProcess) {
338
345
OnEventsToProcessCallbackContext params = {
You can’t perform that action at this time.
0 commit comments