Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cancellation of IOCP::OverlappedOperation #14754

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

straight-shoota
Copy link
Member

When an overlapped operation gets cancelled, we still need to wait for completion of the operation (with status ERROR_OPERATION_ABORTED) before it can be freed.
Previously we stored a reference to cancelled operations in a linked list and removed them when complete. This allows continuing executing the fiber directly after the cancellation is triggered, but it's also quite a bit of overhead.
Also it makes it impossible to allocate operations on the stack.

Cancellation is triggered when an operation times out.

The change in this patch is that after a timeout the fiber is suspended again, expecting completion via the event loop. Then the operation can be freed.

src/crystal/system/win32/iocp.cr Outdated Show resolved Hide resolved
src/crystal/system/win32/iocp.cr Show resolved Hide resolved
@straight-shoota straight-shoota added this to the 1.14.0 milestone Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants