Page 1 of 1

esp32 multithreading with std::future/promise & std::packaged_task

Posted: Fri Jan 06, 2023 8:52 am
by RichPiano
I'm thinking about using std::future/std::promise and std::packaged_task to facilitate multithreading on the esp32. I get that the abstraction layering between the multitasking functions is as follows:

std::thread
pthread
FreeRTOS tasks

In any case I do need the flexibility to set task priorities as well as stack size. I also noted that espressif offers custom pthread extensions (https://docs.espressif.com/projects/esp ... hread.html) that could do the trick. These add-ons are afaik not available for std::thread however.

How do you suggest I do multitasking that is compatible to the desired functionality? Should I start from the pthread layer using the add-ons or is there a way I could go full portability using std::thread?