mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
fix(ble_log): handle scheduler-suspended state in ble_log_rt_queue_trans
During light sleep transitions, the FreeRTOS scheduler is suspended but xPortInIsrContext() returns false, causing xQueueSend with portMAX_DELAY to hit a configASSERT. Add a check for taskSCHEDULER_SUSPENDED and use a non-blocking send with rollback on queue-full to avoid resource leaks.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -185,8 +185,15 @@ BLE_LOG_IRAM_ATTR void ble_log_rt_queue_trans(ble_log_prph_trans_t **trans)
|
||||
|
||||
if (BLE_LOG_IN_ISR()) {
|
||||
BaseType_t woken = pdFALSE;
|
||||
/* Queue depth == total transport buffer count; queue-full is impossible
|
||||
* for a valid transport, so the return value is not checked. */
|
||||
xQueueSendFromISR(rt_queue_handle, trans, &woken);
|
||||
portYIELD_FROM_ISR(woken);
|
||||
} else if (xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED) {
|
||||
/* Non-blocking send to avoid configASSERT when scheduler is suspended
|
||||
* (e.g., during light sleep transitions). Queue-full is impossible;
|
||||
* see comment above. */
|
||||
xQueueSend(rt_queue_handle, trans, 0);
|
||||
} else {
|
||||
xQueueSend(rt_queue_handle, trans, portMAX_DELAY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user