/* * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */#include"freertos/FreeRTOS.h"#include"freertos/task.h"#include"freertos/semphr.h"#include"esp_compiler.h"#include"esp_private/log_lock.h"5 includes// Maximum time to wait for the mutex in a logging statement.//// We don't expect this to happen in most cases, as contention is low. The most likely case is if a// log function is called from an ISR (technically caller should use the ISR-friendly logging macros but// possible they use the normal one instead and disable the log type by tag).#defineMAX_MUTEX_WAIT_MS10#defineMAX_MUTEX_WAIT_TICKS((MAX_MUTEX_WAIT_MS+portTICK_PERIOD_MS-1)/portTICK_PERIOD_MS)staticSemaphoreHandle_ts_log_mutex=NULL;voidesp_log_impl_lock(void){if(unlikely(!s_log_mutex)){s_log_mutex=xSemaphoreCreateMutex();}{...}if(unlikely(xTaskGetSchedulerState()==taskSCHEDULER_NOT_STARTED)){return;}{...}xSemaphoreTake(s_log_mutex,portMAX_DELAY);}{ ... }boolesp_log_impl_lock_timeout(void){if(unlikely(!s_log_mutex)){s_log_mutex=xSemaphoreCreateMutex();}{...}if(unlikely(xTaskGetSchedulerState()==taskSCHEDULER_NOT_STARTED)){returntrue;}{...}returnxSemaphoreTake(s_log_mutex,MAX_MUTEX_WAIT_TICKS)==pdTRUE;}{ ... }voidesp_log_impl_unlock(void){if(unlikely(xTaskGetSchedulerState()==taskSCHEDULER_NOT_STARTED)){return;}{...}xSemaphoreGive(s_log_mutex);}{ ... }
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.