Skip to content

refactor: create I/O services on first use - #373

Merged
sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/lazy-services
Sep 28, 2026
Merged

sgerbino merged 1 commit into
cppalliance:developfrom
sgerbino:pr/lazy-services

Conversation

@sgerbino

Copy link
Copy Markdown
Collaborator

Backend construct() registered every protocol service eagerly, and the scheduler constructors did the same for the resolver, signal, and file services, so every program linked the full service surface of every compiled backend.

Registration now happens on first use. The abstract scheduler becomes a registry service keyed under its own type — the concrete schedulers already declared that key but the base was not findable — so services constructed from only an execution_context can locate the scheduler without naming a concrete backend type. Each public I/O object gets or creates its service through a per-protocol dispatch helper that probes which scheduler the context was built with, so the linker keeps only the services of the protocols a program actually names. Acceptor services get-or-create the stream service they hand accepted descriptors to.

@cppalliance-bot

cppalliance-bot commented Sep 28, 2026 •

Copy link
Copy Markdown

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

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

2026-09-28 17:29:38 UTC

@cppalliance-bot

cppalliance-bot commented Sep 28, 2026 •

Copy link
Copy Markdown

GCOVR code coverage report https://373.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://373.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://373.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-09-28 17:45:41 UTC

Backend construct() registered every protocol service eagerly, and the
scheduler constructors did the same for the resolver, signal, and file
services, so every program linked the full service surface of every
compiled backend.

Registration now happens on first use. The abstract scheduler becomes
a registry service keyed under its own type — the concrete schedulers
already declared that key but the base was not findable — so services
constructed from only an execution_context can locate the scheduler
without naming a concrete backend type. Each public I/O object gets or
creates its service through a per-protocol dispatch helper that probes
which scheduler the context was built with, so the linker keeps only
the services of the protocols a program actually names. Acceptor
services get-or-create the stream service they hand accepted
descriptors to.
@sgerbino
sgerbino merged commit 54e28fd into cppalliance:develop Sep 28, 2026
43 checks passed
@sgerbino
sgerbino deleted the pr/lazy-services branch September 28, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants