Different Output after each execution
Moritz Maxeiner via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Aug 18 03:50:28 PDT 2017
On Friday, 18 August 2017 at 10:06:04 UTC, Vino wrote:
> On Friday, 18 August 2017 at 08:34:39 UTC, ikod wrote:
>> On Friday, 18 August 2017 at 08:00:26 UTC, Vino.B wrote:
>>> Hi All,
>>>
>>> I have written a small program to just list the directories,
>>> but when i run the program each time i am getting different
>>> output, hence request you help, below is the code
>>>
>>> [...]
>>
>> Do you expect some strict execution order when you run
>> 'parallel' foreach?
>
> Yes, the order of execution should be the same as the order of
> the directory provided to scan.
Then you cannot parallelize the work[1], use:
---
auto dFiles = dirEntries(Dirlist[i], SpanMode.shallow).filter!(a
=> a.isDir);
foreach (d; dFiles)
{
writefln("%-63s %.20s", d, d.timeCreated().toSimpleString);
}
---
[1] You cannot parallelize computations that depend on each
other, which you make yours do by requiring a specific order of
execution.
More information about the Digitalmars-d-learn
mailing list