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

[Concurrency] Build executors as their own separate object modules. #76483

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Sep 16, 2024

We want to split the global executor implementations out into their own separate object files, because that will allow us to provide a custom executor specific to the target platform when using Embedded Concurrency.

rdar://135380149

C++ executor implementations were `#include`ed into `GlobalExecutor.cpp`,
which makes it difficult to replace the global executor when using the
Embedded Concurrency library.  Refactor things so that they build into
separate objects, which means replacing them is just a matter of writing
the relevant functions yourself.

rdar://135380149
`ExecutorHooks.h` is now nothing to do with hooks, so rename it.  Also
there are some additional functions it should declare, and a couple of
places where we've slightly messed up the boundary, for instance
`swift_task_asyncMainDrainQueue` was defined in `Task.cpp` rather than
in the executor implementations, which is wrong, so fix that too.

`CooperativeGlobalExecutor.cpp` now builds against the interface from
`ExecutorImpl.h`, rather than including the all the concurrency headers.

rdar://135380149
When Embedded Concurrency is enabled, install `ExecutorImpl.h` in the
`include/swift` directory in the toolchain.

rdar://135380149
Added an executor implementation and a test that tries to use it.
Also fix up a few issues in `ExecutorImpl.h`.

rdar://135380149
@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair al45tair marked this pull request as ready for review September 20, 2024 15:04
@al45tair al45tair requested a review from a team as a code owner September 20, 2024 15:04
@al45tair
Copy link
Contributor Author

Hmmm. Looks like I've broken a few tests there :-) More to do, it seems.

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.

1 participant