Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0b0dfab

Browse filesBrowse files
authored
Fix race in log_printf (espressif#5523)
Fixes: espressif#5513 Can still race if Serial.begin() is not called in setup()
1 parent 5fd7379 commit 0b0dfab
Copy full SHA for 0b0dfab

File tree

1 file changed

+8
-6
lines changed
Filter options

1 file changed

+8
-6
lines changed

‎cores/esp32/esp32-hal-uart.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-uart.c
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -648,17 +648,19 @@ int log_printf(const char *format, ...)
648648
return 0;
649649
}
650650
}
651-
vsnprintf(temp, len+1, format, arg);
652651
#if !CONFIG_DISABLE_HAL_LOCKS
653652
if(s_uart_debug_nr != -1 && _uart_bus_array[s_uart_debug_nr].lock){
654653
xSemaphoreTake(_uart_bus_array[s_uart_debug_nr].lock, portMAX_DELAY);
655-
ets_printf("%s", temp);
656-
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
657-
} else {
658-
ets_printf("%s", temp);
659654
}
660-
#else
655+
#endif
656+
657+
vsnprintf(temp, len+1, format, arg);
661658
ets_printf("%s", temp);
659+
660+
#if !CONFIG_DISABLE_HAL_LOCKS
661+
if(s_uart_debug_nr != -1 && _uart_bus_array[s_uart_debug_nr].lock){
662+
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
663+
}
662664
#endif
663665
va_end(arg);
664666
if(len >= sizeof(loc_buf)){

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.