Skip to content

fix(iocp): block indefinitely when idle instead of polling every 500ms#295

Merged
mvandeberg merged 1 commit into
cppalliance:develop-2from
mvandeberg:pr/288-iocp-wakeups
Jun 30, 2026
Merged

fix(iocp): block indefinitely when idle instead of polling every 500ms#295
mvandeberg merged 1 commit into
cppalliance:develop-2from
mvandeberg:pr/288-iocp-wakeups

Conversation

@mvandeberg

Copy link
Copy Markdown
Contributor

The IOCP scheduler and its auxiliary wait reactor both capped their blocking wait (GetQueuedCompletionStatus / WSAPoll) at 500ms. The 500ms came from Asio's default_gqcs_timeout, but Asio applies it only on pre-Vista Windows to work around a GQCS bug; on Vista+ it uses INFINITE. corosio targets modern Windows only, and timers, posted work, and reactor registrations already wake their loops precisely (waitable timer thread, PostQueuedCompletionStatus, self-pipe). So:

  • Both loops now block indefinitely; only the failed wake-up post/send is fatal (matches Asio), since it can only fail under resource exhaustion.
  • The one-time shutdown drain loop keeps a finite wait so it makes progress.
  • Remove the gqcs_timeout_ms option and configure_iocp(): its only effect was forcing idle wake-ups, and Asio does not expose it.

The IOCP scheduler and its auxiliary wait reactor both capped their
blocking wait (GetQueuedCompletionStatus / WSAPoll) at 500ms. The 500ms came from Asio's default_gqcs_timeout, but Asio applies it only
on pre-Vista Windows to work around a GQCS bug; on Vista+ it uses
INFINITE. corosio targets modern Windows only, and timers, posted work,
and reactor registrations already wake their loops precisely (waitable
timer thread, PostQueuedCompletionStatus, self-pipe). So:

- Both loops now block indefinitely; only the failed wake-up post/send is
  fatal (matches Asio), since it can only fail under resource exhaustion.
- The one-time shutdown drain loop keeps a finite wait so it makes
  progress.
- Remove the gqcs_timeout_ms option and configure_iocp(): its only effect
  was forcing idle wake-ups, and Asio does not expose it.
@cppalliance-bot

Copy link
Copy Markdown

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

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

2026-06-30 19:53:55 UTC

@cppalliance-bot

Copy link
Copy Markdown

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

Build time: 2026-06-30 20:00:24 UTC

@mvandeberg mvandeberg merged commit 87d11b9 into cppalliance:develop-2 Jun 30, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Jun 30, 2026
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