Skip to content

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