How long does portMAX_DELAY actually wait in FreeRTOS?
Although portMAX_DELAY is listed as value for waiting indefinitely, it will only actually wait indefinitely if INCLUDE_vTaskSuspend is enabled in the FreeRTOS config.
portMAX_DELAY is typically defined as 0xFFFFFFFF i.e. 2^32-1:
portmax_delay.cpp
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL(however if 16 bit ticks are enabled using configUSE_16_BIT_TICKS it will be defined as 0xFFFF (2^16-1).
In case INCLUDE_vTaskSuspend is enabled, this is treated as a special value and will actually wait indefinitely. If INCLUDE_vTaskSuspend is not defined, it will only wait for 0xFFFFFFFF ticks (assuming 32-bit system ticks.
In other words, this will wait for only about 7 weeks if FreeRTOS is defined to tick every millisecond.
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow