mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Improve in order synchronous enqueue of startSynchronously
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
This commit is contained in:
@@ -1069,7 +1069,7 @@ SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
|
||||
void swift_task_startOnMainActor(AsyncTask* job);
|
||||
|
||||
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
|
||||
void swift_task_startSynchronously(AsyncTask* job);
|
||||
void swift_task_startSynchronously(AsyncTask* job, SerialExecutorRef targetExecutor);
|
||||
|
||||
/// Donate this thread to the global executor until either the
|
||||
/// given condition returns true or we've run out of cooperative
|
||||
|
||||
Reference in New Issue
Block a user