Skip to content

coroutine: add Coroutine::AsyncQueue and immediate evaluation support in LeafAwaitable - #46885

Draft
penguingao wants to merge 32 commits into
envoyproxy:mainfrom
penguingao:coroutine_async_queue_jetski
Draft

coroutine: add Coroutine::AsyncQueue and immediate evaluation support in LeafAwaitable#46885
penguingao wants to merge 32 commits into
envoyproxy:mainfrom
penguingao:coroutine_async_queue_jetski

Conversation

@penguingao

@penguingao penguingao commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Commit Message:
Add a Coroutine::AsyncQueue implementation. This is a useful utility to pass buffer / items among coroutines. Immediate use case is in APM's AI filter manager implementation that's forthcoming in a next PR.

AsyncQueue::push and AsyncQueue::pop can be used with co_await. Non-blocking methods are available.

The implementation can share capacity among multiple instances. It's typical for a buffer to be passed in a chain of queues, and we'd like the total bytes in the queues to be bound in size.

I used AI to generate this PR. I have read the code and understand it.

Additional Description:
Risk Level: low - new utility
Testing: unit tests
Docs Changes: N/A - internal utility
Release Notes: N/A - internal utility
Platform Specific Features: no

@repokitteh-read-only

Copy link
Copy Markdown

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #46885 was opened by penguingao.

see: more, trace.

…itable

Signed-off-by: Peng Gao <pengg@google.com>
…yncQueue

Signed-off-by: Peng Gao <pengg@google.com>
…haring issues in AsyncQueue

Signed-off-by: Peng Gao <pengg@google.com>
@penguingao
penguingao force-pushed the coroutine_async_queue_jetski branch from b92c22e to 1b43a77 Compare August 22, 2026 13:11
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Implements AsyncQueue and SharedCapacity using coroutine async primitives (AsyncEvent),
providing FIFO async channels, bounded capacity management, move-only type support,
and direct handoff semantics.

Signed-off via git commit -s.

Signed-off-by: Peng Gao <pengg@google.com>
…ere appropriate

Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
…_jetski

Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
@penguingao

Copy link
Copy Markdown
Contributor Author

/retest

Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
This reverts commit 7a9abb9.

Signed-off-by: Peng Gao <pengg@google.com>
…ferences

Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
…tests

Avoid immediately-invoked lambda coroutines with captures in
AsyncQueueTest and SemaphoreTest to prevent stack-use-after-scope
under ASan. Pass Semaphore by reference to coroutine task in
DestructionWhileProcessWaitersScheduled so the test retains sole
ownership of the Semaphore shared_ptr.

TAG=agy
CONV=1167748b-3e90-4d8d-8e9c-4f141b6cbdd2

Signed-off-by: Peng Gao <pengg@google.com>
Signed-off-by: Peng Gao <pengg@google.com>
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