The Swift Actor Pitfall: Understanding and Managing Reentrancy
summary
Actors prevent data races but allow logic bugs when an awaited call creates a suspension point and a second task re-enters, exemplified by two concurrent withdrawals of $800 and $500 against an $11,000 balance that nevertheless ends negative. Concrete fixes use Swift async actors: avoid mutable-state access across suspension points, authorize before checking or recheck after suspension, and treat suspension points as the place to audit or serialize state changes rather than assume sequential safety.
AI-written summary · about
related talks
29mWilling Suspension of Disbelief
31mYour Brain 🧠 on Swift Concurrency
47mDo We Really Need Actors in Swift Concurrency?
30mA Practical Guide to Swift Concurrency
23mSwift Concurrency is new and hard, and you can do it
26mSwift Concurrency Under the Hood
44mSwift 6, Async/Await, SwiftUI went into a Bar...
45mHow We Adapted the Project to Strict Concurrency Checking — Swift 6
