I have a case where simply using
xQueueOverwrite() would probably work. But since it’s a “single writer - single reader” case, I thought it would be a better idea to use Message Buffers, as I know that they are more lightweight than Message Queues. Unfortunately, there is no function like
The first thing comes to mind is resetting the message buffer before sending new data:
xMessageBufferReset(buffer); xMessageBufferSend(buffer, /* other arguments */);
But this method may fail, as
xMessageBufferReset() fails if there is a task blocked on the message buffer which is quite likely.
Is there a suggested workaround for this problem? Is it possible that a function like
xMessageBufferOverwrite() can be added to FreeRTOS API in the future? Or should I just use
xQueueOverwrite() without worrying about the possible performance gains that could be achieved if I could use a message buffer instead of a message queue?