system_api: call shutdown handlers in reverse order

Similar to how destructors should be called in reverse order to the
constructors.
pull/4198/head
Ivan Grokhotkov 2019-10-07 16:36:18 +02:00
rodzic 2f38a1a362
commit f0563b3844
1 zmienionych plików z 5 dodań i 6 usunięć

Wyświetl plik

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