Skip to content

Add non-blocking tx_queue_peek - #855

Open
spir6s wants to merge 1 commit into
eclipse-threadx:masterfrom
spir6s:feature/tx_queue_peek_nonblocking
Open

spir6s wants to merge 1 commit into
eclipse-threadx:masterfrom
spir6s:feature/tx_queue_peek_nonblocking

Conversation

@spir6s

@spir6s spir6s commented Nov 30, 2026 •

Copy link
Copy Markdown

Implements #838 (non-blocking variant).

tx_queue_peek(queue_ptr, destination_ptr, wait_option) copies the message that the next tx_queue_receive would return, without removing it. This includes the message of a tx_queue_front_send thread suspended on a full queue.

  • Only TX_NO_WAIT is supported; any other wait option returns TX_WAIT_ERROR. The parameter is kept so a blocking peek can be added later without breaking callers.
  • Returns TX_QUEUE_EMPTY if the queue is empty.
  • Never suspends and runs in constant time, so it can be called from ISRs and timers.
  • No changes to existing queue services.
  • Includes the error-checking wrapper, trace event TX_TRACE_QUEUE_PEEK, module manager and module library support, the SMP copy, and regression test threadx_queue_peek_test.c (tx and smp).

Alternative with blocking support: #856

PR checklist

  • Updated function header with a short description and version number
  • Added test case for bug fix or new feature
  • Validated on real hardware

tx_queue_peek copies the message that the next tx_queue_receive would
return without removing it. The wait_option parameter is kept for a
possible future blocking peek, but only TX_NO_WAIT is supported; any
other value returns TX_WAIT_ERROR. The service never suspends, runs in
constant time, is callable from ISRs and timers, and requires no
changes to existing queue services.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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