Skip to content

Add tx_queue_peek with wait_option (blocking) - #856

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

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

Conversation

@spir6s

@spir6s spir6s commented Nov 30, 2026 •

Copy link
Copy Markdown

Implements #838 (blocking variant, similar to FreeRTOS xQueuePeek).

  • If the queue is not empty, copies the front message without removing it (including the message of a suspended tx_queue_front_send).
  • If the queue is empty and a wait option is given, the thread suspends on the queue's suspension list.
  • tx_queue_send and tx_queue_front_send hand a copy of the message to all peeking threads at the head of the suspension list, then deliver the message to a receiver or the queue as usual. There is no extra cost when no peeking thread is waiting; otherwise send time grows with the number of waiting peeking threads.
  • 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 without changes to existing services: #855

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

…x#838)

tx_queue_peek copies the message that the next tx_queue_receive would
return without removing it. If the queue is empty, the caller may
suspend according to wait_option. tx_queue_send and tx_queue_front_send
hand a copy of the message to every peeking thread at the head of the
suspension list before delivering it as usual; there is no extra cost
when no peeker is waiting.

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