-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Android][Linux] Fixed hang when using RunLoop.main.run with Date() #2544
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
[Android][Linux] Fixed hang when using RunLoop.main.run with Date() #2544
Conversation
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, it could use a test to verify the appropriate behavior
Yup same here and agreed about the test... |
I'm building for Ubuntu now to test out the test I added. The result will be pass/hang though. I did notice that two of the other RunLoop tests are commented out, with a reference to SR-399. This appears to be an issue on Darwin, so I don't see it as related to this fix. |
@swift-ci test linux |
Is the test status stuck? Jenkins is claiming that it was a success. |
@Molanda Sometimes the status message from Jenkins -> Github gets lost, i'll start the test again |
@swift-ci test linux |
Thank you! |
@swift-ci test linux |
Has the build job been changed? Build 3810 completed successfully on 10/27 with all of my changes. The last step was "Creating installable package".
This step has been replaced in Build 3825 with the following...
And "Installing swiftpm" now fails with the following error:
|
The Swift Package Manager – Benchmarks build error was fixed this morning, after Simon launched the tests. @swift-ci test linux |
Great, thank you! |
What is the next step for this one? |
Sorry for the delays. I just merged. Congrats! |
When using
RunLoop.main.run(mode: .default, before: Date())
on Android, the call would not return.This function, along with
limitDate
(which also would hang), callsCFRunLoopRunInMode
. According to the documentation, this should return immediately if seconds is 0.I traced the problem to
__CFRunLoopRun
where there are a few platform specific cases for draining the message queue. In theTARGET_OS_LINUX
case, the polling condition was not being considered.This PR fixes the parameter to be
poll ? 0 : TIMEOUT_INFINITY
as is done for the other platforms, which allows polling to work on Android.