I want to make sure about the semantics of unshared variables.

import std.concurrency;
import core.thread;
ubyte[1024 * 1024] buf1MB;
void fun() { Thread.sleep(5000.msecs); }
void testThread() {
        foreach(i; 0..2000) {
                spawn(&fun);
        }
}

Are instances of buf1MB created for every threads?
Even if it is never accessed by the threads?
If some static variable is defined in other module
or in some library, all of them also instantiated
for every threads?
BTW, calling testThread() above causes following
run time error. Is this an expected result?

core.thread.ThreadError@src\core\thread.d(2903): Error creating thread
----------------
0x0047B1A7
0x0042ABD4
0x0042AB3B
0x0042AB27
0x0042ADF9
0x00474C22
0x00474BF7
0x00474B0F
0x0042AE13
0x757A7C04 in BaseThreadInitThunk
0x7735AD1F in RtlInitializeExceptionChain
0x7735ACEA in RtlInitializeExceptionChain

Reply via email to