refactor OpFinishHandle to support CQEHandler#39
Conversation
There was a problem hiding this comment.
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
CQEHandlertypes (SimpleCQEHandler,SelectBufferCQEHandler) and makesOpFinishHandlea template over aCQEHandlerLike. - Replaces direct
OpFinishHandle*CQE casting withOpFinishHandleBase*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.
d433f83 to
164fbe5
Compare
There was a problem hiding this comment.
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 castsio_uring_cqe_get_data(cqe)toOpFinishHandleBase*viastatic_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.
No description provided.