Skip to content

stream_buffer: require batching buffers to exceed the trigger level#1396

Open
officialasishkumar wants to merge 1 commit intoFreeRTOS:mainfrom
officialasishkumar:fix/stream-batching-trigger-threshold
Open

stream_buffer: require batching buffers to exceed the trigger level#1396
officialasishkumar wants to merge 1 commit intoFreeRTOS:mainfrom
officialasishkumar:fix/stream-batching-trigger-threshold

Conversation

@officialasishkumar
Copy link
Copy Markdown

Description

Batching stream buffers are documented to unblock receivers only after the buffered byte count exceeds the trigger level. Both xStreamBufferSend() and xStreamBufferSendFromISR() currently notify as soon as the count reaches that level, which wakes a blocked receiver too early and can make xStreamBufferReceive() return 0 bytes while the buffer still holds exactly trigger-level data.

This change routes both send paths through a shared helper so batching buffers require a strict greater-than check, while stream and message buffers keep their existing trigger semantics.

Test Steps

  1. Built the existing FreeRTOS/Test/CMock/stream_buffer/api harness against the updated FreeRTOS-Kernel working tree.
  2. Ran focused local batching-buffer regression cases against that harness for both the task send path and the ISR send path.

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

#1375

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

Batching stream buffers are documented to unblock receivers only after the buffered byte count exceeds the trigger level, but both xStreamBufferSend() paths currently notify as soon as the count reaches it.

That equality case wakes the blocked receiver too early, causing xStreamBufferReceive() to return 0 bytes while the buffer still holds exactly trigger-level data. Route both task and ISR send paths through a shared trigger helper so batching buffers require a strict greater-than check while existing stream and message buffer semantics remain unchanged.

Fixes FreeRTOS#1375

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

@officialasishkumar officialasishkumar marked this pull request as ready for review April 4, 2026 11:39
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