[Issue 13727] New: std.stdio.File not thread-safe
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Nov 12 18:45:48 PST 2014
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 at puremagic.com
Reporter: thecybershadow at 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 at 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).
--
More information about the Digitalmars-d-bugs
mailing list