Skip to content

Commit 965f15d

Browse files
authored
Merge pull request #9231 from kjbracey-arm/critical_volatile
critical sections: remove unnecessary volatile
2 parents 8c55b0a + 70af016 commit 965f15d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

hal/mbed_critical_section_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121

2222
#include <stdbool.h>
2323

24-
static volatile bool critical_interrupts_enabled = false;
25-
static volatile bool state_saved = false;
24+
static bool critical_interrupts_enabled = false;
25+
static bool state_saved = false;
2626

2727
static bool are_interrupts_enabled(void)
2828
{

platform/mbed_critical.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#endif
4444
#endif
4545

46-
static volatile uint32_t critical_section_reentrancy_counter = 0;
46+
static uint32_t critical_section_reentrancy_counter = 0;
4747

4848
bool core_util_are_interrupts_enabled(void)
4949
{
@@ -77,11 +77,11 @@ bool core_util_in_critical_section(void)
7777

7878
void core_util_critical_section_enter(void)
7979
{
80+
hal_critical_section_enter();
81+
8082
// If the reentrancy counter overflows something has gone badly wrong.
8183
MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX);
8284

83-
hal_critical_section_enter();
84-
8585
++critical_section_reentrancy_counter;
8686
}
8787

0 commit comments

Comments
 (0)