SuperHouse / esp-open-rtos

Open source FreeRTOS-based ESP8266 software framework
BSD 3-Clause "New" or "Revised" License
1.52k stars 491 forks source link

bugfix/ets_timer.c: race condition while disarming #607

Closed FlavioBayer closed 6 years ago

FlavioBayer commented 6 years ago

If sdk_ets_timer_arm_ms_us is called right after vPortExitCritical inside sdk_ets_timer_disarm on line 247 (by an ISR for example, which was my case), execution will loop forever on line 196, since timer->next!=ETS_TIMER_NOT_ARMED, which was supposed to be changed in line 248. By delaying the IRS or context switch until sdk_ets_timer_disarm the problem is fixed.