Skip to content

Proposal: Task.startSynchronously #2698

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

Merged
merged 7 commits into from
Mar 27, 2025

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Feb 19, 2025

New Concurrency API that allows to "synchronously start a Task from the calling context", allowing for more detailed control over execution ordering and even access async functions from synchronous contexts.

@ktoso ktoso force-pushed the wip-task-synchronously-start branch from 589952b to b41bec5 Compare February 19, 2025 08:38
@rjmccall rjmccall added the LSG Contains topics under the domain of the Language Steering Group label Feb 24, 2025
@ktoso
Copy link
Contributor Author

ktoso commented Mar 4, 2025

This should be ready to go!

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

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

Some minor editorial changes, but otherwise LGTM. Once you've applied these, I can start the review—thanks!

// SE-NNNN's proposed 'name: String? = nil' would be here
priority: TaskPriority? = nil,
executorPreference taskExecutor: consuming (any TaskExecutor)? = nil,
operation: sending @escaping async throws(Failure) -> Success,
Copy link
Member

Choose a reason for hiding this comment

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

I think the parameter list was dropped here and in startSynchronouslyDetached—should these by sending @escaping () async throws(Failure) -> Success?

@ktoso
Copy link
Contributor Author

ktoso commented Mar 26, 2025

Applied all the comments and I removed the isolated(any) from the code because that's not quite how it works, we'll need some custom internal attribute in available to the concurrency runtime to implement these isolation semantics. It would not be publicly accessible though so removed it from the proposal.

@ktoso
Copy link
Contributor Author

ktoso commented Mar 26, 2025

@allevato I think we're good here. You can kick off the review then -- I'm offline this week but I'll keep an eye on the review thread, thank you!

@ktoso ktoso requested a review from allevato March 26, 2025 13:16
@allevato allevato merged commit 7d5ae36 into swiftlang:main Mar 27, 2025
@allevato
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSG Contains topics under the domain of the Language Steering Group
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants