i have some actor lifecycle logic that works like:
actor A
{
var state:State
var x:Int?
}
extension A
{
func drain() async
{
self.x = nil
await withCheckedContinuation
{
self.state = .draining($0)
}
}
}
but the documentation for withCheckedContinuation
says:
Suspends the current task, then calls the given closure with a checked continuation for the current task.
(emphasis added)
does this mean it is possible for concurrently-executing code to observe self.x == nil
, but self.state != .draining($0)
in the same critical section?