<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Am 23.08.2017 um 12:29 schrieb Thomas via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 23 Aug 2017, at 11:28, Thomas via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">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...</span></div></blockquote></div><br class=""><div class="">Maybe that's where Futures would come in handy? Just return a Future from the method so callers can await long-running operations.</div></div></div></blockquote><div><br class=""></div><div>If you wrap the call to a long-running operation of another actor in a `beginAsync`, I would assume that other `actor funcs` of your actor will be able to run even while</div><div> the long-running operation is pending:</div><div><br class=""></div><div>actor class Caller {</div><div> let callee = Callee()</div><div> var state = SomeState()</div><div><br class=""></div><div> actor func foo() {</div><div> beginAsync {</div><div> let result = await callee.longRunningOperation()</div><div> // do something with result and maybe state</div><div> }</div><div> }</div><div> actor func bar() {</div><div> // modify actor state</div><div> }</div><div>}</div><div><br class=""></div><div>Note, that in this case while waiting asynchronously on the long-running operation, the state of the caller might get changed by another of its `actor funcs` running.</div><div>Sometimes this might be intended - e.g. for cancellation - but it also could lead to hard to find bugs...</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">Thomas</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>