Nested Mutexes and Priority Inheritance

Hi, I am using an Atmel AVR32 uP (UC3A0512) and have based most of my application around the drivers provided by Atmel’s Software Framework.  The documentation for freeRTOS mentions ” … the priority inheritance mechanism implemented by mutexes is only a basic form that assumes that a task will only hold a single mutex at any one time … “.  What is likely to happen if a task were to hold more than 1 mutex at a time?  I ask this as it seems the Atmel’s file system will cause a task to hold 2 mutexes.  There is a mutex on the SPI hardware (for access to a dataFlash/SdCard) and another mutex on the higher level file operations.  Is this likely to cause problems? Thanks,
Chris.

Nested Mutexes and Priority Inheritance

Whether or not it will cause problems depends on the the priorities of the tasks holding the mutexes. The priority inheritance assumes that only one mutex will be held at a time.  If two mutexes are held then the priority will be inherited to that of the highest task priority that is attempting to access the same mutex, but will be dropped back to the base priority when either mutex is returned.  This could result in some priority inversion, but this won’t necessarily cause you a problem, and in fact some inversion must have already existed for the inheritance to have been triggered in the first place. Regards.

Nested Mutexes and Priority Inheritance

OK, so FreeRTOS won’t get upset by it, my application may not behave as I’d expected. Thanks Again,
Chris.