Skip to content

[Concurrency] Provide a Swift interface for custom main and global executors. #80266

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 4 commits into from
Mar 31, 2025

Conversation

al45tair
Copy link
Contributor

Reorganise the Concurrency code so that it's possible to completely implement executors (both main and global) in Swift.

Provide API to choose the desired executors for your application.

Also make Task.Sleep wait using the current executor, not the global executor, and expose APIs on Clock to allow for conversion between time bases.

rdar://141348916

@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair al45tair force-pushed the custom-executors-take2 branch from c22fdfc to 648e666 Compare March 28, 2025 10:09
…-custom-executors"

This reverts commit 06f6358, reversing
changes made to 033f667.
We need to provide some of the additional functions, as stubs, for
task-to-thread model.

rdar://141348916
There were a couple of comments that needed updating, and a typo
in a function name.

rdar://141348916
Tweaked diagnostic to use a string instead of a type.  Renamed the
feature in `FeatureAvailability.def` (and added the `TaskExecutor`
feature to 6.2).  Also fixed the `swift_getActiveExecutor()`
function to return the main executor only when on the main thread.

rdar://141348916
@al45tair al45tair force-pushed the custom-executors-take2 branch from 648e666 to 6e28716 Compare March 28, 2025 10:15
@al45tair
Copy link
Contributor Author

Rebased.

@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

@al45tair al45tair merged commit b1c345f into swiftlang:main Mar 31, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants