pThread - freeRTOS task interoperability

Working with Amazon FreeRTOS 10.0.1 my application creates several threads with pThread_Create(). At some point I need to notify a waiting thread/task from within an ISR. For tasks I can do this with vTaskNotifyGiveFromISR() but I don’t see a similar method for threads.

I realize that a pThread_Obj has a freeRTOSTask parameter but this is not exposed through the *.h file. So is what I am attempting to do possible at all?

You can still use the native FreeRTOS API too.

You are right that xTaskHandle though stored in pthread_internal_t, it is not exported externally. As Richard mentioned above, you can use xTaskCreate to create your tasks instead of using pthread_create - you will then have access to the task handle which can then be used in vTaskNotifyGiveFromISR.


Hmm, that is a bit more work and essentially replicating (at least part of) the pThread interface. So am I understanding then that there is indeed no equivalent Notification function for threads? Seems a bit of a short coming no?

OK, I solved this by calling xTaskGetCurrentTaskHandle() in each prep section of a thread (i.e. prior to the endless for loop) and storing the result in a small global array. All the gory details hidden by a few methods that can be called globally.

It works, but it seems such a hack for an OS that generally has neat solutions for things like this. I am no expert in freeRTOS but it seems that the pThread_xxx() interface needs a bit more spit and polish.