I am not sure if I am correct, but a Mutex should be just that - Mutual Exclusion. If I take a mutex then no other call for that same mutex should succeed until I give the mutex back. This does not work with existing mutex implementation, as the mutex is implemented as a recursive semaphore. I have a mutex to protect the use of a serial port that is used by more than one task.
The messages that are sent on that port are mixed segments of messages from the multiple tasks.
Does anyone have a fix for this ? If not I will fix this and post the fix.
If I take a mutex then no other call for that same mutex should succeed until I give the mutex back.
Agreed.
This does not work with existing mutex implementation
? I think it does. The three mutex tasks that are implemented in the standard demo GenQTest.c file test the behaviour. Do you have a test case where it does not work as intended?
as the mutex is implemented as a recursive semaphore
? No it isn’t……a mutex is in effect a binary semaphore with the added functionality of priority inheritance - created using the xSemaphoreCreateMutex() API function. The recursive mutex implementation is quite separate, recursive mutexes are created using the xSemaphoreCreateRecursiveMutex() API function. A task cannot take a recursive mutex if it is held by another task, and cannot give one back unless it is already the mutex holder.
Does anyone have a fix for this ? If not I will fix this and post the fix
I’m not convinced there is a problem, so please demonstrate the problem and get agreement that it exists before trying to fix it. If there is a problem then posting a fix would be appreciated, although the bug tracker might be a better place to post it.