Changing the xTicksToWait in xQueueReceive

Hi I just wonder (I couldn’t find the info elsewhere), what happens if the xTicksToWait in the xQueueReceive is changed while the function call is blocked? If the xQueueReceive is called with portMAX_DELAY and that is changed to something else. Would the xQueueReceive return if that new timeout has elapsed or do I have to call xQueueReceive again to use this new timeout? Thomas

Changing the xTicksToWait in xQueueReceive

You are looking at the implementation of an API function – which is fine if you are doing that out of curiosity or want to know how FreeRTOS works.  If on the other hand you are just wanting to use FreeRTOS, then you only need to know the behaviour of the API function, and not how it implements that behavior. If a task calls xQueueReceive() with a block time, then the time at which the task should unblock if there is no data to receive is calculated at the time xQueueReceive() is called – and that value cannot be changed after the function has been called.  The manipulation of xTicksToWait in the function implementation ensures that behaviour is correct – it does not effect the time at which the task unblocks. Regards.