-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] repair cooperative executor and its tests #39365
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] repair cooperative executor and its tests #39365
Conversation
This patch repairs the build failure for cooperative executor. And also fixed main executor to avoid assertion failure due to `witnessTable == nullptr`
Some headers switch their inline implementations based on SWIFT_STDLIB_SINGLE_THREAD_RUNTIME definition. This fixes linking failure while building runtime unittests
preset=buildbot_incremental_linux_crosscompile_wasm |
@swift-ci please smoke test |
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.
I have a couple of small nits (and there's a test failure), but this generally looks very good. Thank you!
ExecutorRef swift::swift_task_getMainExecutor() { | ||
#if SWIFT_CONCURRENCY_COOPERATIVE_GLOBAL_EXECUTOR | ||
return ExecutorRef::forOrdinary(&_swift_mainExecutorIdentity, nullptr); | ||
return ExecutorRef::generic(); |
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.
This is interesting. In the cooperative case, does@MainActor
not really have its own executor, because all executors are the same? Or is it that we should have a main-actor actor and dispatching to it goes in through the same run loop? I think I agree that this is the right approach.
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.
Good point. I respected the former from my understanding, but I'm not confident here.
Some of test cases assumes that the runtime is built for multi-threaded platform.
779ad22
to
0b70235
Compare
@swift-ci please smoke test |
This comment has been minimized.
This comment has been minimized.
The failing test seems unrelated to this change 👀 |
This comment has been minimized.
This comment has been minimized.
4 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@swift-ci please test Windows platform |
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.
Looks good, thanks for poking the CI while it was flaky.
This patch repairs the main executor to avoid assertion failure due to
witnessTable == nullptr
introduced by my previous patch 😓 #39092And fixes and disables some tests that depend on multi-thread based executor implementation detail.
This also fixes CI failure on WebAssembly CI: https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-20.04-webassembly/10/console