November 13, 2014 [Issue 13727] New: std.stdio.File not thread-safe | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13727 Issue ID: 13727 Summary: std.stdio.File not thread-safe Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: major Priority: P1 Component: Phobos Assignee: nobody@puremagic.com Reporter: thecybershadow@gmail.com ////////////// test.d ////////////// import std.array; import std.parallelism; import std.stdio; void main() { foreach (fn; ["test.d"] .replicate(1000) .parallel ) { // synchronized { File f = File(fn, "rb"); } } } //////////////////////////////////// On Windows 32-bit, this program will either deadlock, or print a dozen exceptions such as: std.exception.ErrnoException@std\stdio.d(640): Could not close file `test.d' (No error) Uncommenting the "synchronized" line, or commenting the ".parallel" line fixes the problem. Works fine on 64 bits (with MSVC runtime). -- |
Copyright © 1999-2021 by the D Language Foundation