Merge branch 'bugfix/compare_and_setextram' into 'master'

bugfix/pthread: fix pthread_once() race condiion possibility adding critical section in compare and set function

Closes IDFGH-2448

See merge request espressif/esp-idf!7236
This commit is contained in:
Angus Gratton 2020-01-10 12:29:54 +08:00
commit 6ab9f846c9

View file

@ -443,6 +443,9 @@ static portMUX_TYPE extram_mux = portMUX_INITIALIZER_UNLOCKED;
void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) { void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t *set) {
uint32_t prev; uint32_t prev;
uint32_t oldlevel = portENTER_CRITICAL_NESTED();
#ifdef CONFIG_FREERTOS_PORTMUX_DEBUG #ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
vPortCPUAcquireMutexIntsDisabled(&extram_mux, portMUX_NO_TIMEOUT, __FUNCTION__, __LINE__); vPortCPUAcquireMutexIntsDisabled(&extram_mux, portMUX_NO_TIMEOUT, __FUNCTION__, __LINE__);
#else #else
@ -458,6 +461,8 @@ void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t compare, uint32_t
#else #else
vPortCPUReleaseMutexIntsDisabled(&extram_mux); vPortCPUReleaseMutexIntsDisabled(&extram_mux);
#endif #endif
portEXIT_CRITICAL_NESTED(oldlevel);
} }
#endif //defined(CONFIG_SPIRAM) #endif //defined(CONFIG_SPIRAM)