Pierre responded to the rest of your comments, but I wanted to briefly touch on 
this:

> On Sep 26, 2017, at 11:22 AM, Jean-Daniel via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> In C#, the model is far simple as there is not concept of a single dispatch 
> queue that can execute work on any thread. 


I don’t think this is true in general. The purpose of the 
SynchronizationContext abstraction is that it allows for different kinds of 
threading models, and I think the GCD model could work as well. It may be true 
that in a typical C# application using, say, WPF you don’t have that situation. 
In most C# frameworks you basically have the UI thread’s context and then you 
have the generic “thread pool” context. But the way that SynchronizationContext 
works should allow for you to create a GCD-like system. The way it would work 
is that when you enter a queue then you would push a SynchronizationContext for 
that queue, and when you exit the queue you would pop it (restore the previous 
context). The SynchronizationContext for the queue would implement the Post and 
Send methods to dispatch_async and dispatch_sync, respectively.

Again, it may be true that a typical C# application doesn’t need this, but I 
don’t think there’s anything blocking a GCD-like implementation on C# using 
their system. It’s pretty flexible. I believe a similar system could work for 
Swift.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to