Skip to content

Concurrency: attempt to handle Windows draining #35577

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

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

compnerd
Copy link
Member

Rather than just simply invoking abort on Windows, attempt to load
dispatch and execute the main loop by looking up dispatch_main in the
module. Assuming that dispatch was used already, the LoadLibraryW
will provide the handle to the module currently mapped in. This still
is not correct, since we do not link to libdispatch, so we cannot have
invoked any dispatch queuing methods. However, this is better than the
previous behaviour of simply aborting.

This resolves the symptom in SR-14086, but not the underlying problem.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

Rather than just simply invoking abort on Windows, attempt to load
dispatch and execute the main loop by looking up `dispatch_main` in the
module.  Assuming that dispatch was used already, the `LoadLibraryW`
will provide the handle to the module currently mapped in.  This still
is not correct, since we do not link to libdispatch, so we cannot have
invoked any dispatch queuing methods.  However, this is better than the
previous behaviour of simply aborting.

This resolves the symptom in SR-14086, but not the underlying problem.
@compnerd
Copy link
Member Author

CC: @etcwilde

@compnerd
Copy link
Member Author

@swift-ci please smoke test

@etcwilde
Copy link
Member

Does CoreFoundation compile/work for Windows? If yes, could we match the Mac/Linux behaviour and check for CFRunLoopRun first and use that if present before falling back on dispatch_main? If not, oh well, don't worry about it, LGTM. Thanks for fixing this.

@compnerd
Copy link
Member Author

compnerd commented Jan 25, 2021

CoreFoundation does build/work on Windows. However, we do not have a build of CoreFoundation handy. That is actually a bug in the implementation for non-Darwin platforms (I have another patch for that I will be putting up). The CoreFoundation implementation in Foundation is not meant to be used outside of Foundation (as per @millenomi).

And you're welcome :)

@compnerd compnerd merged commit e08ba66 into swiftlang:main Jan 25, 2021
@compnerd compnerd deleted the infinite-loop-rather-than-explode branch January 25, 2021 01:57
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.

2 participants