From c2e57a67eccb7ef95d998723baea9bb6f37f49e4 Mon Sep 17 00:00:00 2001 From: Walter Bright Date: Mon, 9 May 2016 00:52:25 -0700 Subject: [PATCH] fix Issue 13727 - std.stdio.File not thread-safe --- test/runnable/extra-files/extra13727.txt | 1 + test/runnable/test13727.d | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/runnable/extra-files/extra13727.txt create mode 100644 test/runnable/test13727.d diff --git a/test/runnable/extra-files/extra13727.txt b/test/runnable/extra-files/extra13727.txt new file mode 100644 index 000000000000..6530e9aceb3a --- /dev/null +++ b/test/runnable/extra-files/extra13727.txt @@ -0,0 +1 @@ +It doesn't matter what this file contains, any old junk will do. diff --git a/test/runnable/test13727.d b/test/runnable/test13727.d new file mode 100644 index 000000000000..d39e2086cd29 --- /dev/null +++ b/test/runnable/test13727.d @@ -0,0 +1,23 @@ +// https://issues.dlang.org/show_bug.cgi?id=13727 + +import std.array; +import std.parallelism; +import std.stdio; + +void main() +{ + foreach (fn; + ["runnable/extra-files/extra13727.txt"] + .replicate(1000) + .parallel + ) + { + // synchronized + version (Windows) + string mode = "rb"; + else + string mode = "r"; + { File f = File(fn, mode); } + } +} +