Hello,
I'm trying to get familiar with using multiple tasks on the Esp32 to avoid tasks blocking eachother. Now I understand that a mutex should be used when accessing the same resources, but it is not clear for me at what level that should take place.
Let's say there are three tasks:
- mqtt
- webserver
- general WiFi access
Al of them are using the WiFi resource at some point. Should a mutex be created that prevents accessing the WiFi resource, or is it on for example the mqtt level enough?
Multitasking and use of mutex
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: Multitasking and use of mutex
'WiFi' itself is not a resource that you use directly; it is abstracted by other drivers in ESP-IDF, so you should look at the drivers to see if they need muxes. In general, you can assume that ESP-IDF drivers are re-entrant (meaning you can happily use them in different threads) unless the documentation says differently.
Re: Multitasking and use of mutex
All right thanks. I will look into this.
Is this valid for the Arduino platform also?
Is this valid for the Arduino platform also?
-
- Posts: 9739
- Joined: Thu Nov 26, 2015 4:08 am
Re: Multitasking and use of mutex
Mostly; I'm not sure which APIs on the Arduino side are and aren't re-entrant, though.
Who is online
Users browsing this forum: No registered users and 120 guests