I have a third party library I would like to include into an my ESP-IDF project.
The library uses C++ threads, mutex etc.
My FreeRTOS task would call a library function. The library function would block on a C++11 mutex before sending to a C++ queue. A C++ thread would use the mutex to gain the queue and service.
The FreeRTOS task may therefore be blocked by a C++ mutex held by a C++ thread.
How is C++ threading integrated within the ESP-IDF? I assume that the native implementation is FreeRTOS?
Will .native_handle() return the FreeRTOS equivalent?
Has anyone used C++ threads in ESP-IDF. Are these features stable?
C++11 threads
C++11 threads
& I also believe that IDF CAN should be fixed.
Re: C++11 threads
C++ threading is implemented on top of pthreads (that's the standard implentation in libstdc++v3) which in turn is implemented on top of FreeRTOS in ESP-IDF.
So all threads (pthreads, c++11 threads) are actually FreeRTOS threads, just wrapped with some levels of indirection. Same applies to mutexes. Therefore blocking a FreeRTOS thread on a c++11 mutex is not a problem.
native_handle should return a pointer to a pthread.
So all threads (pthreads, c++11 threads) are actually FreeRTOS threads, just wrapped with some levels of indirection. Same applies to mutexes. Therefore blocking a FreeRTOS thread on a c++11 mutex is not a problem.
native_handle should return a pointer to a pthread.
Re: C++11 threads
I ported some code over that uses pthreads and it works. However, I'm converting it over to use FreeRTOS threads simply because adding an adaptation layer leaves me wondering what might go wrong.
John A
John A
Re: C++11 threads
Which is a FreeRTOS task handle? That is to ask if I could use that handle directly to change priority etc?ESP_igrr wrote:native_handle should return a pointer to a pthread.
& I also believe that IDF CAN should be fixed.
Re: C++11 threads
No, that's an internal structure which contains the handle: https://github.com/espressif/esp-idf/bl ... read.c#L51
Who is online
Users browsing this forum: No registered users and 73 guests