Chapter 2. API Reference
Parameters
• cfg: The pthread config parameters
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p)
Get current pthread creation configuration.
This will retrieve the current configuration that will be used for creating threads.
Return
• ESP_OK if the configuration was available
• ESP_ERR_NOT_FOUND if a configuration wasn’t previously set
Parameters
• p: Pointer to the pthread config structure that will be updated with the currently configured param-
eters
esp_err_t esp_pthread_init(void)
Initialize pthread library.
Structures
struct esp_pthread_cfg_t
pthread configuration structure that influences pthread creation
Public Members
size_t stack_size
The stack size of the pthread.
size_t prio
The thread’s priority.
bool inherit_cfg
Inherit this configuration further.
const char *thread_name
The thread name.
int pin_to_core
The core id to pin the thread to. Has the same value range as xCoreId argument of xTaskCreatePinned-
ToCore.
Macros
PTHREAD_STACK_MIN
2.6.9 Event Loop Library
Overview
The event loop library allows components to declare events to which other components can register handlers –code
which will execute when those events occur. This allows loosely coupled components to attach desired behavior to
changes in state of other components without application involvement. For instance, a high level connection handling
library may subscribe to events produced by the wifi subsystem directly and act on those events. This also simplifies
event processing by serializing and deferring code execution to another context.
Using esp_event APIs
There are two objects of concern for users of this library: events and event loops.
Events are occurrences of note. For example, for WiFi, a successful connection to the access point may be an event.
Events are referenced using a two part identifier which are discussed more here. Event loops are the vehicle by which
Espressif Systems 834
Submit Document Feedback
Release v4.4