parallelism

Arun Chandrasekaran aruncxy at gmail.com
Sat Jan 27 10:49:45 UTC 2018


On Saturday, 27 January 2018 at 10:38:25 UTC, Nicholas Wilson 
wrote:
> On Saturday, 27 January 2018 at 10:28:10 UTC, Arun 
> Chandrasekaran wrote:
>> ```
>>     import std.parallelism;
>>     auto pool = new TaskPool(options.threadCount);
>>     foreach (_; 0 .. options.iterationCount) {
>>         switch (options.operation) {
>>             static foreach(e; EnumMembers!Operation) {
>>                 case e:
>>                      pool.put(task!e(options));
>>                      break;
>>     }
>>     pool.finish();
>> ```
>
> Does that do the trick?

No it doesn't.

```
/usr/include/dmd/phobos/std/parallelism.d(507,34): Error: 
function expected before (), not cast(Operation)0 of type 
Operation
/usr/include/dmd/phobos/std/parallelism.d(835,16): Error: 
template instance std.parallelism.Task!(cast(Operation)0, 
Options) error instantiating
src/app.d(159,32):        instantiated from here: 
task!(cast(Operation)0, Options)
src/app.d(160,17): Error: must use labeled break within static 
foreach

### and so on till the end of enum
```


More information about the Digitalmars-d-learn mailing list