mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
227f8daef3
timer_process_alarm function of esp_timer holds a spinlock for the entire duration of its operation, except for the time when timer callback function is called. It is possible that when timer_process_alarm releases the spinlock, a higher priority task may run and delete the timer. Then the execution will return to timer_process_alarm, and this will either cause a crash, or undesired execution of callback after the timer has been stopped or deleted. To solve this problem, add a mutex which will prevent deletion of timers while callbacks are being dispatched.