September 22, 2014 parallel foreach hangs | ||||
|---|---|---|---|---|
| ||||
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);
}
}
| ||||
September 22, 2014 Re: parallel foreach hangs | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Daniel Kozak | 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.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply