digitalmars.D.learn - parallel foreach hangs
- Daniel Kozak (14/14) Sep 22 2014 this code never end
- anonymous (8/22) Sep 22 2014 Works for me.
- kiran kumari (3/17) Sep 24 2014 see more example
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); } }
Sep 22 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.
Sep 22 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); } }see more example http://techgurulab.com/course/java-quiz-online/
Sep 24 2014