Skip to content

Conversation

@MungoG
Copy link
Contributor

@MungoG MungoG commented Jan 21, 2026

Summary by CodeRabbit

Release Notes

  • Refactor

    • Consolidated internal container implementations used for managing system resources across socket, resolver, and signal handlers on all supported platform backends (epoll, IOCP, POSIX).
  • New Features

    • Extended scheduler operations with new public methods for lifecycle management and user data access.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This PR introduces a local intrusive container implementation (intrusive_list and intrusive_queue) in src/detail/intrusive.hpp, replacing all dependencies on Boost capy's equivalent containers across epoll, iocp, posix, and win implementations. It also enhances scheduler_op with a virtual destroy() method and data() accessor.

Changes

Cohort / File(s) Summary
New intrusive container infrastructure
src/corosio/src/detail/intrusive.hpp
Introduces intrusive_list<T> and intrusive_queue<T> templates with nested node base classes, supporting O(1) push/pop/remove operations with bidirectional/singly-linked storage respectively. Both disable copy semantics and support move construction.
EPOLL implementation migration
src/corosio/src/detail/epoll/resolver_service.hpp, src/corosio/src/detail/epoll/sockets.hpp
Replaced capy::intrusive_list with local intrusive_list in base class inheritance for epoll_resolver_impl, epoll_socket_impl, epoll_acceptor_impl and member lists resolver_list_, socket_list_, acceptor_list_.
IOCP implementation migration
src/corosio/src/detail/iocp/resolver_service.hpp, src/corosio/src/detail/iocp/sockets.hpp
Replaced capy::intrusive_list with local intrusive_list in base class inheritance for win_resolver_impl, win_socket_impl_internal, win_socket_impl, win_acceptor_impl_internal, win_acceptor_impl and member lists.
POSIX signal implementation migration
src/corosio/src/detail/posix/signals.hpp
Replaced capy::intrusive_list with local intrusive_list in posix_signal_impl base class and impl_list_ member.
Windows signal implementation migration
src/corosio/src/detail/win/signals.hpp
Replaced capy::intrusive_list with local intrusive_list in win_signal_impl base class and impl_list_ member.
Scheduler operation enhancements
src/corosio/src/detail/scheduler_op.hpp
Switched from capy::intrusive_queue to local intrusive_queue; added virtual destroy() pure-virtual method, data() const accessor, protected destructor, and void* data_ member for user data storage.
Timer and mock implementation updates
src/corosio/src/detail/timer_service.cpp, src/corosio/src/test/mocket.cpp
Updated intrusive_list usage from capy namespace to local implementation in timer and mock service classes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • vinniefalco

Poem

🐰 A list of rabbits, intrusive and neat,
No capy required for our data to meet,
Local containers, both queue and list,
Hop through the details—no dependency missed! 🌿
Pointers and linkage, all tucked away snug,
Zero-copy goodness in every debug. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective: copying capy's intrusive list as a local implementation detail, which is demonstrated by the new intrusive.hpp file and all references being updated from capy::intrusive_list to the local intrusive_list.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@cppalliance-bot
Copy link

An automated preview of the documentation is available at https://46.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-01-21 12:07:54 UTC

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/corosio/src/detail/intrusive.hpp`:
- Around line 83-101: The splice_back implementation can corrupt the list when
splicing the list into itself; add a self-splice guard at the top of splice_back
by returning immediately if &other == this (before checking other.empty()),
ensuring head_/tail_ are not modified when other is the same object; apply the
identical self-check to the other splice overload in intrusive_list that takes
an intrusive_list& (the other splice method handling head_/tail_ adjustments) so
both paths skip self-splice.

Comment on lines +83 to +101
void
splice_back(intrusive_list& other) noexcept
{
if(other.empty())
return;
if(tail_)
{
tail_->next_ = other.head_;
other.head_->prev_ = tail_;
tail_ = other.tail_;
}
else
{
head_ = other.head_;
tail_ = other.tail_;
}
other.head_ = nullptr;
other.tail_ = nullptr;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard against self-splice to avoid list/queue corruption.

Splicing into the same container will currently create cycles and then clear head_/tail_, effectively corrupting the structure. A simple self-check avoids this class of bugs.

🛠️ Proposed fix
 void
 splice_back(intrusive_list& other) noexcept
 {
+    if (this == &other)
+        return;
     if(other.empty())
         return;
     if(tail_)
     {
         tail_->next_ = other.head_;
         other.head_->prev_ = tail_;
         tail_ = other.tail_;
     }
     else
     {
         head_ = other.head_;
         tail_ = other.tail_;
     }
     other.head_ = nullptr;
     other.tail_ = nullptr;
 }
 void
 splice(intrusive_queue& other) noexcept
 {
+    if (this == &other)
+        return;
     if(other.empty())
         return;
     if(tail_)
         tail_->next_ = other.head_;
     else
         head_ = other.head_;
     tail_ = other.tail_;
     other.head_ = nullptr;
     other.tail_ = nullptr;
 }

Also applies to: 199-211

🤖 Prompt for AI Agents
In `@src/corosio/src/detail/intrusive.hpp` around lines 83 - 101, The splice_back
implementation can corrupt the list when splicing the list into itself; add a
self-splice guard at the top of splice_back by returning immediately if &other
== this (before checking other.empty()), ensuring head_/tail_ are not modified
when other is the same object; apply the identical self-check to the other
splice overload in intrusive_list that takes an intrusive_list& (the other
splice method handling head_/tail_ adjustments) so both paths skip self-splice.

@MungoG MungoG merged commit 0908dd7 into cppalliance:develop Jan 21, 2026
26 of 27 checks passed
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.

3 participants