swift
28c4930f - [Concurrency] Avoid inserting handler record in already cancelled task. (#80456)

Commit
1 year ago
[Concurrency] Avoid inserting handler record in already cancelled task. (#80456) This avoids the potential to race with the triggering coming from task_cancel, because we first set the cancelled flag, and only THEN take the lock and iterate over the inserted records. Because of this we could: T1 flip the cancelled bit; T2 observes that, and triggers "immediately" during installing the handler record. T1 then proceeds to lock records and trigger it again, causing a double trigger of the cancellation handler. resolves https://github.com/swiftlang/swift/issues/80161 resolves rdar://147493150
Author
Parents
Loading