Skip to content

refactor OpFinishHandle to support CQEHandler#39

Merged
wokron merged 8 commits into
masterfrom
add-cqe-handler
Feb 12, 2026
Merged

refactor OpFinishHandle to support CQEHandler#39
wokron merged 8 commits into
masterfrom
add-cqe-handler

Conversation

@wokron
Copy link
Copy Markdown
Member

@wokron wokron commented Feb 12, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors OpFinishHandle to be handler-driven via a new CQEHandlerLike concept, enabling different CQE result-processing strategies (e.g., simple result capture vs. buffer-selection metadata) while keeping the runtime’s CQE dispatch operating on a common base handle type.

Changes:

  • Introduces CQEHandler types (SimpleCQEHandler, SelectBufferCQEHandler) and makes OpFinishHandle a template over a CQEHandlerLike.
  • Replaces direct OpFinishHandle* CQE casting with OpFinishHandleBase* across runtime and tests.
  • Refactors awaiter helpers to construct awaiters with appropriate CQE handlers (including select-buffer operations).

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_ring.cpp Updates tests to use OpFinishHandle<SimpleCQEHandler> and base-pointer CQE dispatch.
tests/test_op_finish_handle.cpp Updates handle types to the templated OpFinishHandle<SimpleCQEHandler> and base-pointer casting.
tests/test_op_awaiter.cpp Updates CQE dispatch casting to OpFinishHandleBase*.
tests/test_awaiter_operations.cpp Updates CQE dispatch casting to OpFinishHandleBase*.
include/condy/runtime.hpp Runtime CQE processing now treats common work items as OpFinishHandleBase*.
include/condy/finish_handles.hpp Introduces OpFinishHandleBase + handler-templated OpFinishHandle, and updates mixins/aliases accordingly.
include/condy/cqe_handler.hpp Adds CQE handler implementations (SimpleCQEHandler, SelectBufferCQEHandler).
include/condy/concepts.hpp Adds CQEHandlerLike concept and updates OpFinishHandleLike to return detail::Action.
include/condy/awaiters.hpp Refactors awaiters to be parameterized by CQEHandlerLike (+ SQE128 flag).
include/condy/awaiter_operations.hpp Updates factory helpers to construct awaiters with the appropriate CQE handlers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/condy/awaiter_operations.hpp Outdated
Comment thread include/condy/awaiter_operations.hpp Outdated
Comment thread include/condy/finish_handles.hpp
Comment thread include/condy/cqe_handler.hpp
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

tests/test_op_finish_handle.cpp:69

  • io_uring_sqe_set_data(sqe, &handle) stores a derived pointer, but the completion path casts io_uring_cqe_get_data(cqe) to OpFinishHandleBase* via static_cast (no offset adjustment). Store a base pointer in user_data (or cast to the exact derived type first and then upcast) to avoid UB and to keep cancellation address matching consistent.
        auto handle_ptr = static_cast<condy::OpFinishHandleBase *>(
            io_uring_cqe_get_data(cqe));
        io_uring_cqe mock_cqe = *cqe;
        mock_cqe.res = 42;
        handle_ptr->handle_cqe(&mock_cqe);
        (*handle_ptr)();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/condy/finish_handles.hpp
Comment thread tests/test_ring.cpp
Comment thread tests/test_ring.cpp
Comment thread tests/test_op_finish_handle.cpp
Comment thread tests/test_op_awaiter.cpp
Comment thread tests/test_awaiter_operations.cpp
Comment thread include/condy/concepts.hpp
Comment thread include/condy/runtime.hpp
Comment thread include/condy/finish_handles.hpp
Comment thread include/condy/finish_handles.hpp
@wokron wokron merged commit 81c55c7 into master Feb 12, 2026
17 checks passed
@wokron wokron deleted the add-cqe-handler branch February 12, 2026 07:57
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.

2 participants