Skip to content

Refactor CFSocket callbacks to call Process.terminateRunLoop() #3126

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

Closed
wants to merge 1 commit into from

Conversation

pcbeard
Copy link
Contributor

@pcbeard pcbeard commented Jan 17, 2022

This fixes a data race between setting process.isRunning = false
and then calling CFRunLoopSourceInvalidate(process.runLoopSource).
Process.waitUntilExit() may wake up and clear .runLoopSource which
results in a fairly common crash on Windows.

Put this logic in a common method to reduce drift between the
Darwin / Linux and Windows code paths.

Thanks to @compnerd for finding the data race.

This fixes a data race between setting `process.isRunning = false`
and then calling `CFRunLoopSourceInvalidate(process.runLoopSource)`.
Process.waitUntilExit() may wake up and clear .runLoopSource which
results in a fairly common crash on Windows.

Put this logic in a common method to reduce drift between the
Darwin / Linux and Windows code paths.
@pcbeard
Copy link
Contributor Author

pcbeard commented Jan 17, 2022

@swift-ci please test

@pcbeard pcbeard closed this Jan 17, 2022
@pcbeard pcbeard deleted the terminateRunLoop branch January 17, 2022 19:14
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.

1 participant