semaphore - How to use a mutex in FreeRTOS? -


i have shared resources, shared isr , normal task. need serialized accessed. seems neither binarysemaphore nor mutexsemaphore meets needs. utility supposed used?

thanks,

it not idea use mutex in interrupt. start, if interrupt running, can't interrupted task, 1 way protection needed. second, if interrupt can't obtain mutex, can't block wait it, have exit without accessing resource.

if interrupt needs long winded consider deferring interrupt processing task, either 1 of own tasks using direct task notification, or using centralised deferred interrupt processing feature.

if must use semaphore in interrupt, use binary semaphore, not mutex, mutexes have priority inheritance mechanism makes little logical sense in interrupt (priority inheritance tasks inheriting each other's task priority, interrupt not task, , not have task priority).


Comments