With a small number of threads, things work as intended in the code below. But with 1000, on my machine it either crashes or throws an exception:

import std.stdio;
import std.parallelism;
import std.range;


void main() {
    stdout = File("/dev/null", "w");
    foreach(t; 1000.iota.parallel) {
        writeln("Oops");
    }
}



I get, depending on the run, "Bad file descriptor", "Attempting to write to a closed file", or segfaults. What am I doing wrong?

Atila

Reply via email to