mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* [Concurrency] Fix task excutor handling of default actor isolation The task executor API did not properly account for taking the default actor locking into account when running code on it, we just took the job and ran it without checking with the serial executor at all, which resulted in potential concurrent executions inside the actor -- violating actor isolation. Here we change the TaskExecutor enqueue API to accept the "target" serial executor, which in practice will be either generic or a specific default actor, and coordinate with it when we perform a runSynchronously. The SE proposal needs to be amended to showcase this new API, however without this change we are introducing races so we must do this before the API is stable. * Remove _swift_task_enqueueOnTaskExecutor as we don't use it anymore * no need for the new protocol requirement * remove the enqueue(_ job: UnownedJob, isolatedTo unownedSerialExecutor: UnownedSerialExecutor) Thankfully we dont need it after all * Don't add swift_defaultActor_enqueue_withTaskExecutor and centralize the task executor getting to enqueue() * move around extern definitions