richard_damon wrote on Sunday, August 11, 2019:
First, this absolutely does not depreciates the xTickToWait paramater, that still h as a very vital role, the when the task blocks for a notification it really wants to block and not need to keep polling for an event (so other tasks can run), but it also may want to wait for just a limited period of time, and if no event occured, do some other action, and perhaps then go back and wait again.
As to multiple sources, the list you gave is basically all the variants of the Direct to Task API, which has a single base Notify function (and its ISR twin), and then a number of specializations that just effectively provide a value for the eAction parameter and maybe default values for some of the others, but all are just variations of the Notify operation.
Many people have wanted ways to wait for events from many sources, and we have the QueueSet to manage data from multiple Queues and Semaphores. With a Message Buffer there is less need for multiple Queues, as you can make make the messages that are put on the queue indicate what type of message it is and then send them all on the same MessageBuffer. What this doesn’t provide is a way to handle mixing in some Semaphores in this mix. You could create a whole message for each Semaphore, but that adds complexity at the sending end to need to actually build the messages. Letting the program use the Direct to Task Notifications as an array of Semaphores, and the task waiting on the message, gets woken up on sending one of the notifications and on getting the 0 return on the MessageBufferReceive dosn’t process the message not received, and then checks the notification and finds it.
This does slightli complicate programs that don’t use that feature, but not by that much, it does say that they need to check the return value of the Receive, but they really should be anyway out of general principle. if you want the equivalent of the max delay case, just do a
while(!xMessageBufferReceive( ... portMAX_DELAY)) continue;
and that statement won’t move on until a message is received.
Note this issue only happens if a task does both MessageBuffers and Direct to Task Notifications, and I really suspect that most of the time, if that notification occurs, the task wants to handle the notification, not continue to wait for the message.
Look at the example that started the thread, A timer signaled a motor fault to the task, I would expect that that is likely wanted to be processed now, rather than waiting for some message, which by the portMAX_DELAY period, may well be a long time in comming (if you were expecting it soon, there would be a timeout to handle it getting lost).