'Access Violation Error' with parallel-foreach loop

ooyu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Mar 18 09:15:30 PDT 2017


When i was uing parallel-foreach loop, got this error:

 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
object.Error@(0): Access Violation
----------------
0x0056CCB8 in _flushbu
0x005663C7 in fwrite
0x0041D39F in nothrow @nogc @trusted uint 
std.stdio.trustedFwrite!(char).trustedFwrite(shared(core.stdc.stdio._iobuf)*, const(char[]))
at C:\D\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(3836)
0x004611AA in D3std6format99__T14formattedWri at 
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(556)
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄

code is here:
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
foreach( web_url; parallel(urls) ){
     try{
         auto rq = Request(); // using dlang-requests library
         auto d = rq.get( std.uri.encode(web_url) ); // file url

         File f = File(path_hash[web_url], "wb");
         f.write( d.responseBody );
         f.close();
     }
     catch(std.exception.ErrnoException e){}
}
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄

I don't understand why got Access Violation error. :-(


More information about the Digitalmars-d-learn mailing list