parallel foreach hangs
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Sep 22 06:30:05 PDT 2014
On Monday, 22 September 2014 at 11:25:53 UTC, Daniel Kozak wrote:
> this code never end
>
> import std.stdio;
> import std.file;
> import std.parallelism : parallel;
> import std.algorithm : filter;
>
> void main(string[] args)
> {
> foreach(d; parallel(args[1 .. $], 1))
> {
> auto phpFiles =
> filter!`endsWith(a.name,".php")`(dirEntries(d,SpanMode.depth));
> writeln(phpFiles);
> }
> }
Works for me.
Be aware that dirEntries traverses the whole directory structure
recursively. So when you let it loose on something like root or
your home directory, it may take a while.
If that's not it, try to define a complete test scenario:
directories, files, compiler version, command line for compiling,
command line for running, etc.
More information about the Digitalmars-d-learn
mailing list