Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSwiftactors and actor isolationSingle-choice MCQ

Two `await` calls appear back-to-back inside an `actor` method. Between the first `await` resuming and the second `await` starting, what guarantee does the actor make about its protected state?

actor Counter { var value = 0 func bump() async { value += 1 await Task.yield() // suspension point 1 let snapshot = value await Task.yield() // suspension point 2 value = snapshot + 1 } }