Structured Concurrency vs P2300R7

Paolo Invernizzi paolo.invernizzi at gmail.com
Sun Apr 7 10:33:08 UTC 2024


I've seen again Sebastiaan talk about structured concurrency, I 
know it's not a verbatim port of P2300R7, so trying to grok it I 
started to code in D some P2300R7 examples.

The second example is basically some parallel computation over an 
array on doubles, powered by the `execution::bulk` adaptor, 
basically one way to execute one callable multiple times in 
parallel over an input.

What is confusing me is that the Stream concept is not present in 
P2300, so I'm not sure about one basic thing, how to span 
parallel computations and reduce the results.

What's the correct way to instantiate 'n' senders to execute a 
callable via a threadPool scheduler, and pass them as 'whenAll' 
parameter?

What the way to perform the classic D example:

```
auto logs = new double[1_000_000];

foreach (i, ref elem; parallel(logs))
{
     elem = log(i + 1.0);
}
```

Are Streams involved?

Thank you


More information about the Digitalmars-d mailing list