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

Add make*Future methods to isolated event loop #3152

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

glbrntt
Copy link
Contributor

@glbrntt glbrntt commented Mar 20, 2025

Motivation:

Creating a completed future of a non-sendable value when on the current event loop is currently a little tedious. It requires you to create a promise, succeed it using the isolated view, or fail it using the non-isolated view. This is more tedious than it needs to be.

Modifications:

  • Add make{Succeeded,Failed,Completed}Future methods to the isolated event loop. These don't require the Success value to be Sendable.

Result:

It's easier to create completed futures of non sendable values from an isolated event loop.

Motivation:

Creating a completed future of a non-sendable value when on the current
event loop is currently a little tedious. It requires you to create a
promise, succeed it using the isolated view, or fail it using the
non-isolated view. This is more tedious than it needs to be.

Modifications:

- Add `make{Succeeded,Failed,Completed}Future` methods to the isolated
  event loop. These don't require the `Success` value to be `Sendable`.

Result:

It's easier to create completed futures of non sendable values from an
isolated event loop.
@glbrntt glbrntt added the 🆕 semver/minor Adds new public API. label Mar 20, 2025
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.

Nice one, thanks @glbrntt!

@Lukasa Lukasa merged commit 6b00972 into apple:main Mar 20, 2025
39 of 42 checks passed
@glbrntt glbrntt deleted the isolated-make-complete-future branch March 21, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants