[swift-evolution] [Concurrency] async/await + actors

Thomas tclementdev at free.fr
Wed Aug 23 04:28:36 CDT 2017


Just wanted to sum up my actors interrogation here:

1. What happens to the actor's queue when the body of a (non void-returning) actor method awaits away on some other actor? Does it suspend the queue to prevent other messages from being processes? It would seem to be the expected behavior but we'd also need a way to detach from the actor's queue in order to allow patterns like starting a long-running background operation and still allowing other messages to be processed (for example, calling a cancel() method). We could still do these long-running operations by passing a completion block to the method, rather than via its return value. That would clarify this goes beyond this one actor message, but we're back to the old syntax...

2. Clarification about whether we are called back on the actor's queue after awaiting on some other code/actor.

3. How do we differentiate between void-returning methods that can be awaited and void-returning methods that are oneway "fire and forget". These two methods written as of now:

fund doSomething(completionHandler: () -> ()) -> Void
func doSomething() -> Void

Currently they'd translate both to:

actor func doSomething() -> Void


Thomas



More information about the swift-evolution mailing list