system_api: call shutdown handlers in reverse order

Similar to how destructors should be called in reverse order to the
constructors.
This commit is contained in:
Ivan Grokhotkov 2019-10-07 16:36:18 +02:00
parent 2f38a1a362
commit f0563b3844

View file

@ -230,12 +230,11 @@ void esp_restart_noos(void) __attribute__ ((noreturn));
void IRAM_ATTR esp_restart(void) void IRAM_ATTR esp_restart(void)
{ {
int i; for (int i = SHUTDOWN_HANDLERS_NO - 1; i >= 0; i--) {
for (i = 0; i < SHUTDOWN_HANDLERS_NO; i++) { if (shutdown_handlers[i]) {
if (shutdown_handlers[i]) { shutdown_handlers[i]();
shutdown_handlers[i](); }
} }
}
// Disable scheduler on this core. // Disable scheduler on this core.
vTaskSuspendAll(); vTaskSuspendAll();