Queuing items with timeouts
Posted by incrediball
on June 25, 2011
I have an idea / feature request:
I often find myself in the situation when I want to put something in a queue for a while, i.e. give it a timestamp when the receiving task is able to retrieve the item. Often it may be the same task that has retrieved a command from a command queue but isn't able to process it at that time (because something may be busy and we don't want to wait for it), then it would be nice to stick it back in the queue but not have to deal with the problem that the task will just immediately fetch the item out of the queue again. Doing a forced delay before calling xQueueReceive is not always appropriate because the task might have other things to do.
The idea is that xQueueReceive blocks until an item in the queue times out and then it is returned. Note that unlike regular queues, the items would be returned in the order in which they time out - not in the order that they were posted. So, strictly speaking it wouldn't really be a queue.
Just an idea but I can't really figure out an elegant way of dealing with this situation without something like this.
Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd..
See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.