Ver Fonte

Make GPIO state polling atomic without holding map lock

SybexXx há 2 dias atrás
pai
commit
5104ba58ba
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      code/components/jomjol_controlGPIO/server_GPIO.h

+ 1 - 1
code/components/jomjol_controlGPIO/server_GPIO.h

@@ -72,7 +72,7 @@ private:
     bool _httpEnable = false;
     bool _httpEnable = false;
     bool _isrRegistered = false;
     bool _isrRegistered = false;
     GpioIsrContext _isrContext = {};
     GpioIsrContext _isrContext = {};
-    int currentState = -1;
+    std::atomic<int> currentState{-1};
 };
 };
 
 
 esp_err_t callHandleHttpRequest(httpd_req_t *req);
 esp_err_t callHandleHttpRequest(httpd_req_t *req);