You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 20, 2025. It is now read-only.
I'm running ESPAsyncWebServer on ESP32, with AsyncTCP obviously.
I don't create any FreeRTOS tasks myself so I only have the Arduino loop() checking for some flags. Those flags are set from inside callbacks I passed to the ESPAsyncWebServer and AsyncTCP libraries.
However I only recently took a closer look at the source of the AsyncTCP library and realized a new task is created for calling the user supplied callbacks. Am I right in thinking that I should synchronize access between any variables accessed by both the loop() function and the callbacks (both in ESPAsyncWebServer and AsyncTCP) to prevent possible race conditions?
I'm asking because I haven't really seen this mentioned explicitly somewhere. I'm guessing it's only an "issue" on the ESP32?
Yes, you are right. The loop() is running in a task with prio 1 and the ESPAsyncWebserver is running in a separste task with prio 3. This means you have to consider concurreny access.
...unless variable access is atomic, that is, variable type is primitive (i.e. bool, uint32), you only read or write value (not read-modify-write) and both tasks use the same CPU core, if I understand correctly
this is kinda blowing my mind atm. could someone please be so kind and provide a simple example which demonstrates this issue? I might currently experience it but I'm not sure.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Activity
BlueAndi commentedon Dec 10, 2019
Yes, you are right. The loop() is running in a task with prio 1 and the ESPAsyncWebserver is running in a separste task with prio 3. This means you have to consider concurreny access.
me21 commentedon Dec 24, 2019
...unless variable access is atomic, that is, variable type is primitive (i.e. bool, uint32), you only read or write value (not read-modify-write) and both tasks use the same CPU core, if I understand correctly
mamama1 commentedon Jan 18, 2020
hi,
this is kinda blowing my mind atm. could someone please be so kind and provide a simple example which demonstrates this issue? I might currently experience it but I'm not sure.
Thanks!
stale commentedon Mar 18, 2020
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
stale commentedon Apr 1, 2020
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.