I loved Swift 6.4's new withTaskCancellationShield, until I saw it only works on the 27 OSes. So I dug into why, and built a way to use it on earlier versions.
Actors let tasks slip through reentrancy and a Mutex can't be held across an await — so how do you guarantee an async method never runs twice at once? A line-by-line look at how Matt Massicotte's TaskGate pulls it off.
‘We can’t touch that code — it’s all callback-based!’ Sound familiar? As a developer, you’ve probably heard this countless times, or even said it yourself.