我正在尝试在ESP32上进行锁定实验。显然,有不同的方法来实现锁定:
There is the default C++ mutex library:
#include <mutex> std::mutex mtx; mtx.lock(); mtx.unlock();
And there is the implementation from RTOS:
SemaphoreHandle_t xMutex = xSemaphoreCreateMutex(); xSemaphoreTake(xMutex, portMAX_DELAY); xSemaphoreGive(xMutex);
我需要知道是否存在根本性的差异?还是它们是等效的?