ARM-software / CMSIS-FreeRTOS

FreeRTOS adaptation for CMSIS-RTOS Version 2
https://arm-software.github.io/CMSIS-FreeRTOS/
Other
528 stars 141 forks source link

osThreadGetPriority API can not return caller priority #68

Closed leodicarpaccio closed 1 year ago

leodicarpaccio commented 1 year ago

Hello,

Unfortunately, with current implementation of osThreadGetPriority API, it's impossible to get current priority of calling task because thread_id input parameter can not be NULL. It's a shame because internal call of freeRTOS API (uxTaskPriorityGet) support this feature. Could it be corrected ?

Thanks

VladimirUmek commented 1 year ago

Hi,

to retrieve the running thread priority using RTOS2 API you can use the following: osPriority_t priority = osThreadGetPriority(osThreadGetId());

CMSIS-RTOS2 API is a bit more restrictive and does not allow NULL for a thread_id in osThreadGetPriority to allow better error handling.

leodicarpaccio commented 1 year ago

Hi,

Ok it make sense. Sorry for disturbance, I should have searched deeper. Regards

VladimirUmek commented 1 year ago

No worries ;)