mirror of
https://github.com/espressif/esp-mqtt.git
synced 2026-06-05 21:04:46 +00:00
feat: Make state and size atomic
This makes the mqtt client state atomic to reduce the scope of locking in some parts of the code.
This commit is contained in:
@@ -114,7 +114,7 @@ struct esp_mqtt_client {
|
||||
esp_transport_handle_t transport;
|
||||
mqtt_config_storage_t *config;
|
||||
mqtt_state_t mqtt_state;
|
||||
mqtt_client_state_t state;
|
||||
_Atomic mqtt_client_state_t state;
|
||||
uint64_t refresh_connection_tick;
|
||||
int64_t keepalive_tick;
|
||||
uint64_t reconnect_tick;
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ typedef struct outbox_item {
|
||||
STAILQ_HEAD(outbox_list_t, outbox_item);
|
||||
|
||||
struct outbox_t {
|
||||
uint64_t size;
|
||||
_Atomic uint64_t size;
|
||||
struct outbox_list_t *list;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user