Select one of the symbols to view example projects that use it.
 
Outline
#include "nvs_platform.hpp"
#include "sys/lock.h"
nvs::Lock::Lock()
nvs::Lock::~Lock()
nvs::Lock::init()
nvs::Lock::uninit()
nvs::Lock::mSemaphore
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/nvs_flash/src/nvs_platform.cpp
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include "nvs_platform.hpp" using namespace nvs; #ifdef LINUX_TARGET Lock::Lock() {} Lock::~Lock() {} esp_err_t nvs::Lock::init() {return ESP_OK;} void Lock::uninit() {}/* ... */ #else #include "sys/lock.h" Lock::Lock() { // Newlib implementation ensures that even if mSemaphore was 0, it gets initialized. // Locks mSemaphore _lock_acquire(&mSemaphore); }{ ... } Lock::~Lock() { // Unlocks mSemaphore _lock_release(&mSemaphore); }{ ... } esp_err_t Lock::init() { // Let postpone initialization to the Lock::Lock. // It is designed to lazy initialize the semaphore in a properly guarded critical section return ESP_OK; }{ ... } void Lock::uninit() { // Uninitializes mSemaphore. Please be aware that uninitialization of semaphore shared and held by another thread // can cause undefined behavior if (mSemaphore) { _lock_close(&mSemaphore); }{...} }{ ... } _lock_t Lock::mSemaphore = 0; /* ... */ #endif
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.