missing data with parallel and stdin

Jack Stouffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon May 23 07:16:13 PDT 2016


On Monday, 23 May 2016 at 08:59:31 UTC, moechofe wrote:
>     void delegate(string source,string dest) handler;
>
>     if(use_symlink) handler = delegate(string s,string d){
>         symlink(s,d);
>     }; else handler = delegate(string s,string d){
>         copy(s,d);
>     };

Boy that's a confusing way to write that. Here's a clearer version

if(use_symlink)
     handler = delegate(string s,string d){ symlink(s,d); };
else
     handler = delegate(string s,string d){ copy(s,d); };

> What did I do wrong?

Sounds like a data race problem. Use a lock on the file write 
operation and see if that helps.


More information about the Digitalmars-d-learn mailing list