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:
Euripedes Rocha
2024-03-12 08:49:36 +01:00
parent fa88da5282
commit 891380bdf5
3 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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
View File
@@ -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;
};