[swift-evolution] [Concurrency] Fixing race conditions in async/await example

Adam Kemp adam.kemp at apple.com
Mon Sep 11 15:48:11 CDT 2017


Sorry, I was away for a while so I couldn’t respond to this right away.

> On Aug 29, 2017, at 12:29 AM, Jonathan Hull <jhull at gbis.com> wrote:
> 
> If you are asking about how ‘async’ (which defers ‘await’) composes, it actually composes completely naturally… and I believe that should be provable.  

Can you show me specifically how that would work, then? For instance, let’s say that we want to start N (unknown, i.e., not constant) async requests and then, only once all of them have begun, wait for all them to complete. What would that code look like?

Extending that example, let’s say we wanted to use one function to start the N requests and then use a different function to wait on them. What would be the signatures of these functions?



More information about the swift-evolution mailing list