Actor is reentrant. This means that func endpoint() async -> Result can be called several times. Yes, it is guaranteed that at the same time only one task can be executed on an actor. But after function is suspended, another call can occur.
Image the following:
func endpoint() async -> Resultis called. Under the hood it calls thewithCheckedThrowingContinuationfunction, where old callback based function is called. Immediately after thatwithCheckedThrowingContinuationbecome suspended until continuation will be resumed. So, as it becomes suspended, actor "become free" and can execute another func.func endpoint() async -> Resultis called one more time, and then one more....- lots of call to
func endpoint() async -> Resultwere made - the first call of
func endpoint() async -> Resultresumed
There are some separate discussions like Actor Reentrancy - #2 by DevAndArtist