mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-02 12:14:32 +02:00
docs: update esp_expresstion_with_stack code snippet to check shared stack and mutex allocation.
This commit is contained in:
@@ -32,9 +32,11 @@ The usage may looks like the code below:
|
|||||||
{
|
{
|
||||||
//Allocate a stack buffer, from heap or as a static form:
|
//Allocate a stack buffer, from heap or as a static form:
|
||||||
portSTACK_TYPE *shared_stack = malloc(8192 * sizeof(portSTACK_TYPE));
|
portSTACK_TYPE *shared_stack = malloc(8192 * sizeof(portSTACK_TYPE));
|
||||||
|
assert(shared_stack != NULL);
|
||||||
|
|
||||||
//Allocate a mutex to protect its usage:
|
//Allocate a mutex to protect its usage:
|
||||||
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
||||||
|
assert(printf_lock != NULL);
|
||||||
|
|
||||||
//Call the desired function using the macro helper:
|
//Call the desired function using the macro helper:
|
||||||
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock,
|
||||||
|
Reference in New Issue
Block a user