I mean, yeah, targeted concurrency warnings tell me that passing that value is unsafe, but clearly it's fine. Swift concurrency just doesn't know enough about how things work in the real world.

OK, fine, I'll look, and yeah, I see the really tiny race condition it could cause in some weird corner case, but that's definitely not what's causing this failure.

**Narrator voice:** (you all know what the narrator voice said)

When exploring race conditions in async/await code, I would like to suggest a tool that's been helping me:

Before and after every `await`, and at the beginning of every Task, add a Task.sleep (I use 100ms).

This will ensure that suspension points are long enough that rare things can happen more often.

You're just expanding the suspension points here, not adding new ones. Adding new suspension points would change the semantics of your code.

Don't use Thread.sleep here. That's very different.

@cocoaphony Someone should invent “await sanitiser”. I’ve no idea how it’d work but, then again, I’ve no idea how TSan works either!
@cocoaphony do you use a wrapper function to make this less tedious? Or just sprinkle it everywhere?

@bens just sprinkle it in the places I’m investigating. Wrappers would actually make it harder than cmd-v.

But now you have me thinking of a SwiftSyntax approach :)

@cocoaphony @bens can’t wait for the “Race Me” Xcode Extension
@cocoaphony that’s where my head went initially 😅