I was looking at the GateMutexPri module, thinking about how I might add timeout behaviors to it - or alternatively add priority inheritance to a semaphore based approach. While there, I found the function GateMutexPri_insertPri. It really looks like It isn't correctly finding the task handle in a Task_PendElem. Instead, it seems like it is casting a Queue_Elem pointer to be a task handle. Am I nuts? Or is there a problem here? (See gates/GateMutexPri.c, down at the bottom of the file.)
Jim,
GateMutexPri_insertPri() is an internal function used to insert a Task object into a queue, in the proper order based upon the Task’s priority. The first element of at Task object is a Queue_Elem, which allows the object to be queued. So, the “(Task_Handle)qelem))” may look strange, but it is what is intended.
Scott
Thanks, Scott.