Repository navigation
Multi-reactor threading with socket hand-off inbox - #9
Merged
Merged
Conversation
The MSVC/MinGW presets existed only in the working tree; CI passed because it configures with explicit flags. Now ck.ps1 -Toolchain works from a clean clone.
Server::run now runs an acceptor (the calling thread) plus K reactor threads (threads=0 -> hardware_concurrency). Accepted sockets move to a reactor over a mutex-guarded inbox woken by net::Wakeup (POSIX socketpair; Windows loopback pair) - a Connection is owned by exactly one reactor, so connection state stays lock-free. Round-robin placement; deadlines, backpressure and drain-then- drop stop are per-reactor. Fix found on the Linux gate: SIGINT turns accept poll into EINTR; the error path used to join reactors and the normal stop path joined them again -> pthread_join EINVAL out of run(). Interrupted now just re-checks stop, and stopAll joins only joinable threads. Tests: cross-reactor keep-alive (12 conns / 4 reactors), stop-drain across all reactors, pipelined storm with interleaved fresh clients - all under CI TSan. Linux gates re-run under Docker Desktop after podman/VS disappeared from this machine; clang-format now invoked via LLVM path in the local gate.
AgentDudu
force-pushed
the
feature/reactor-threading
branch
from
October 20, 2026 11:10
ef6e5a7 to
7e64e6e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Acceptor + K reactor threads; per-connection ownership, no shared connection state.
pthread_join EINVAL via run()); stopAll is joinable()-guarded
reactor, pipelined storms with fresh mid-flight clients (CI TSan exercises)
configures with explicit flags, so only local ck.ps1 -Toolchain was blind)