Skip to content

Remove post-timeout re-check in queue receive paths#1408

Open
AniruddhaKanhere wants to merge 1 commit intoFreeRTOS:mainfrom
AniruddhaKanhere:fix/queue-timeout-asymmetry
Open

Remove post-timeout re-check in queue receive paths#1408
AniruddhaKanhere wants to merge 1 commit intoFreeRTOS:mainfrom
AniruddhaKanhere:fix/queue-timeout-asymmetry

Conversation

@AniruddhaKanhere
Copy link
Copy Markdown
Member

xQueueReceive, xQueueSemaphoreTake, and xQueuePeek re-checked the queue state after timeout expiry and looped back if data had arrived, while xQueueGenericSend returned errQUEUE_FULL directly on timeout.

Remove the post-timeout re-check from all three receive-side functions to make timeout behavior symmetric with the send path. Once the timeout has expired, return errQUEUE_EMPTY directly.

For xQueueSemaphoreTake, the mutex priority disinheritance logic is retained and now runs unconditionally on timeout.

Refs FreeRTOS/FreeRTOS#65 Forum: https://forums.freertos.org/t/xqueuegenericsend-and-xqueuereceive/24856

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

xQueueReceive, xQueueSemaphoreTake, and xQueuePeek re-checked the
queue state after timeout expiry and looped back if data had arrived,
while xQueueGenericSend returned errQUEUE_FULL directly on timeout.

Remove the post-timeout re-check from all three receive-side functions
to make timeout behavior symmetric with the send path. Once the
timeout has expired, return errQUEUE_EMPTY directly.

For xQueueSemaphoreTake, the mutex priority disinheritance logic is
retained and now runs unconditionally on timeout.

Refs FreeRTOS/FreeRTOS#65
Forum: https://forums.freertos.org/t/xqueuegenericsend-and-xqueuereceive/24856
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant