-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency][startSynchronously] Improve in order synchronous enqueue of startSynchronously #80821
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
ktoso
merged 2 commits into
swiftlang:main
from
ktoso:wip-refine-scheduling-of-task-start-synchronously
Apr 16, 2025
Merged
[Concurrency][startSynchronously] Improve in order synchronous enqueue of startSynchronously #80821
ktoso
merged 2 commits into
swiftlang:main
from
ktoso:wip-refine-scheduling-of-task-start-synchronously
Apr 16, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Previously there was still a sneaky hop which caused ordering issues. This introduced a specific test startSynchronously_order which checks that the task enqueues indeed are "immediate" and cleans up how we handle this. This also prepares for the being discussed in SE review direction of this API that it SHOULD be ALLOWED to actually hop and NOT be synchronous at all IF the isolation is specified on the closure and is DIFFERENT than the callers dynamic isolation. This effectively implements "synchronously run right now if dynamically on the exact isolation as requested by the closure; otherwise enqueue the task as usual". resolves rdar://149284186 cc @drexin
@swift-ci please smoke test |
ktoso
commented
Apr 15, 2025
@@ -59,14 +59,30 @@ extension Task where Failure == ${FAILURE_TYPE} { | |||
public static func startSynchronously( | |||
name: String? = nil, | |||
priority: TaskPriority? = nil, | |||
@_inheritActorContext @_implicitSelfCapture _ operation: __owned sending @escaping () async throws -> Success | |||
% # NOTE: This closure cannot be 'sending' because we'll trigger ' pattern that the region based isolation checker does not understand how to check' |
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.
TODO: figure out the exact signature we want here
@swift-ci please smoke test |
drexin
approved these changes
Apr 15, 2025
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.
LGTM, thank you!
xedin
added a commit
to xedin/swift
that referenced
this pull request
May 28, 2025
swiftlang#80821 added `@isolated(any)` which is an ABI breaking change but since we are not planning to keep this API around, let's use `@_silgen_name` to bring the old name back for now. Resolves: rdar://152178221
xedin
added a commit
to xedin/swift
that referenced
this pull request
May 28, 2025
swiftlang#80821 added `@isolated(any)` which is an ABI breaking change but since we are not planning to keep this API around, let's use `@_silgen_name` to bring the old name back for now. Resolves: rdar://152178221
ktoso
pushed a commit
to ktoso/swift
that referenced
this pull request
May 28, 2025
swiftlang#80821 added `@isolated(any)` which is an ABI breaking change but since we are not planning to keep this API around, let's use `@_silgen_name` to bring the old name back for now. Resolves: rdar://152178221
ktoso
pushed a commit
to ktoso/swift
that referenced
this pull request
May 28, 2025
swiftlang#80821 added `@isolated(any)` which is an ABI breaking change but since we are not planning to keep this API around, let's use `@_silgen_name` to bring the old name back for now. Resolves: rdar://152178221
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously there was still a sneaky hop which caused ordering issues. This introduced a specific test startSynchronously_order which checks that the task enqueues indeed are "immediate" and cleans up how we handle this.
This also prepares for the being discussed in SE review direction of this API that it SHOULD be ALLOWED to actually hop and NOT be synchronous at all IF the isolation is specified on the closure and is DIFFERENT than the callers dynamic isolation.
This effectively implements "synchronously run right now if dynamically on the exact isolation as requested by the closure; otherwise enqueue the task as usual".
resolves rdar://149284186
cc @drexin