I got 4 threads running on ESP32 (dual core):
- 1 thread running on 1st core which is related to the WiFi.
- 1 thread running on 2nd core which is related to the touchscreen.
- 1 thread running on 2nd core which is related to the display.
- 1 thread running on 2nd core which is related to the sensors.
Some of the threads execute almost instantly, while for instance the one handling the sensors can take a few seconds per interaction, and no blocking should occur meanwhile for the rest of the threads.
Anyway, with the growing of the program, a lot of variables started to be involved in data transfers between the cores, and since the whole thing is about to be redone, I have the following questions, to clear the things up for myself, since I found quite a lot of confusing, even contradictory information in examples and explanations on the internet:
- Is the "volatile" keyword really sufficient for exchange of data between threads (no ISR)?
- Should "volatile" always be between "noInterrupts()" and "interrupts()", even when there is no ISR function?
- What approaches should be used when exchanging a lot of variables between the threads (currently about 40 variables, but the number will probably grow)?
- Is xQueueSend / xQueueReceive blocking in case it is put all around the threads with different variables?