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

Thomas tclementdev at free.fr
Wed Aug 23 05:29:39 CDT 2017


> On 23 Aug 2017, at 11:28, Thomas via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 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...

Maybe that's where Futures would come in handy? Just return a Future from the method so callers can await long-running operations.

Thomas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170823/22b5564c/attachment.html>


More information about the swift-evolution mailing list