mirror of https://github.com/ARMmbed/mbed-os.git
fix(pan-cordio): Wrap call to wsfOsReadyToSleep in a critical section
The function wsfOsReadyToSleep should only be called when interrupts are disabled. Entering a critical section before calling the function fixes any potential issues.pull/8876/head
parent
f60c2c9aa8
commit
5782e93a19
|
@ -17,6 +17,7 @@
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "us_ticker_api.h"
|
#include "us_ticker_api.h"
|
||||||
#include "BLE.h"
|
#include "BLE.h"
|
||||||
|
#include "CriticalSectionLock.h"
|
||||||
#include "wsf_types.h"
|
#include "wsf_types.h"
|
||||||
#include "wsf_msg.h"
|
#include "wsf_msg.h"
|
||||||
#include "wsf_os.h"
|
#include "wsf_os.h"
|
||||||
|
@ -412,6 +413,8 @@ void BLE::callDispatcher()
|
||||||
|
|
||||||
wsfOsDispatcher();
|
wsfOsDispatcher();
|
||||||
|
|
||||||
|
CriticalSectionLock critical_section;
|
||||||
|
|
||||||
if (wsfOsReadyToSleep()) {
|
if (wsfOsReadyToSleep()) {
|
||||||
static Timeout nextTimeout;
|
static Timeout nextTimeout;
|
||||||
// setup an mbed timer for the next Cordio timeout
|
// setup an mbed timer for the next Cordio timeout
|
||||||
|
|
Loading…
Reference in New Issue