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

Adam Kemp adam.kemp at apple.com
Fri Aug 25 19:03:02 CDT 2017


I’m not sure I understand. What is the connection between references and deadlocks?

> On Aug 25, 2017, at 1:07 PM, Marc Schlichte <marc.schlichte at googlemail.com> wrote:
> 
> 
>> Am 25.08.2017 um 19:08 schrieb Adam Kemp via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:
>> 
>> I understand what you’re saying, but I just think trying to make synchronous, blocking actor methods goes against the fundamental ideal of the actor model, and it’s a recipe for disaster. When actors communicate with each other that communication needs to be asynchronous or you will get deadlocks. It’s not just going to be a corner case. It’s going to be a very frequent occurrence.
>> 
>> One of the general rules of multithreaded programming is “don’t call unknown code while holding a lock”. Blocking a queue is effectively the same as holding a lock, and calling another actor is calling unknown code. So if the model works that way then the language itself will be encouraging people to call unknown code while holding locks. That is not going to go well.
>> 
> 
> I would claim - without having a prove though - that as long as you don’t invoke async actor methods on weak or unowned actor references and the code is retain cycle free, no deadlocks will happen.
> 
> Cheers
> Marc
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170825/2cc70a30/attachment.html>


More information about the swift-evolution mailing list