feat(log): Refactoring lock APIs

This commit is contained in:
Konstantin Kondrashov
2024-05-02 12:36:32 +03:00
parent 4ad9ad8086
commit ec594e2c6f
5 changed files with 6 additions and 11 deletions
+27
View File
@@ -0,0 +1,27 @@
/*
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <pthread.h>
#include <assert.h>
#include "esp_private/log_lock.h"
static pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
void esp_log_impl_lock(void)
{
assert(pthread_mutex_lock(&mutex1) == 0);
}
bool esp_log_impl_lock_timeout(void)
{
esp_log_impl_lock();
return true;
}
void esp_log_impl_unlock(void)
{
assert(pthread_mutex_unlock(&mutex1) == 0);
}