Skip to content
New issue

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

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

Already on GitHub? # to your account

EventLoopFuture.waitSpinningRunLoop() #2985

Merged
merged 2 commits into from
Nov 21, 2024
Merged

Conversation

weissi
Copy link
Member

@weissi weissi commented Nov 21, 2024

Motivation:

In some (probably niche) scenarios, especially in pre-Concurrency UI applications on Darwin, it can be useful to wait for an a value whilst still running the current RunLoop. That allows the UI and other things to work whilst we're waiting for a future to complete.

Modifications:

  • Add NIOFoundationCompat.EventLoopFuture.waitSpinningRunLoop().

Result:

Better compatibility with Cocoa.

@weissi weissi requested a review from Lukasa November 21, 2024 11:25
@weissi weissi added the 🆕 semver/minor Adds new public API. label Nov 21, 2024
@weissi weissi force-pushed the jw-wait-runloop branch 4 times, most recently from 8798791 to 6dccd4e Compare November 21, 2024 11:56
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this generally looks good! A few notes in the diff.

@weissi weissi requested a review from Lukasa November 21, 2024 14:35
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fab, thanks @weissi!

@Lukasa
Copy link
Contributor

Lukasa commented Nov 21, 2024

Note that the unit tests aren't passing.

@weissi weissi enabled auto-merge (squash) November 21, 2024 18:06
@weissi weissi merged commit 2a8811a into apple:main Nov 21, 2024
42 of 43 checks passed
Lukasa pushed a commit to Lukasa/swift-nio that referenced this pull request Nov 22, 2024
### Motivation:

In some (probably niche) scenarios, especially in pre-Concurrency UI
applications on Darwin, it can be useful to wait for an a value whilst
still running the current `RunLoop`. That allows the UI and other things
to work whilst we're waiting for a future to complete.

### Modifications:

- Add `NIOFoundationCompat.EventLoopFuture.waitSpinningRunLoop()`.

### Result:

Better compatibility with Cocoa.

(cherry picked from commit 2a8811a)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants