mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(console): join the REPL task before esp_console_stop_repl frees it
This commit is contained in:
@@ -33,6 +33,11 @@ void esp_console_repl_task(void *args)
|
||||
xSemaphoreTake(repl_com->state_mux, portMAX_DELAY);
|
||||
}
|
||||
|
||||
/* Tell esp_console_start_repl() that state_mux is now held. */
|
||||
if (repl_com->task_ready != NULL) {
|
||||
xSemaphoreGive(repl_com->task_ready);
|
||||
}
|
||||
|
||||
/* Change standard input and output of the task if the requested UART is
|
||||
* NOT the default one. This block will replace stdin, stdout and stderr.
|
||||
*/
|
||||
@@ -356,5 +361,10 @@ esp_err_t esp_console_start_repl(esp_console_repl_t *repl)
|
||||
|
||||
repl_com->state = CONSOLE_REPL_STATE_START;
|
||||
xTaskNotifyGive(repl_com->task_hdl);
|
||||
|
||||
/* Return only once the task holds state_mux, so a stop can join it. */
|
||||
if (repl_com->task_ready != NULL) {
|
||||
xSemaphoreTake(repl_com->task_ready, portMAX_DELAY);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user