Very intresting. Next question. :)
Lets consider this example.
import core.thread;
import std.stdio;

shared char[] s;
char[] l = "shared text".dup;

void main() {
 Thread worker = new Thread(&workerFunc);
 worker.start();
Thread.sleep(dur!"seconds"(5)); // after this point worker thread and its // local storage most likely destroyed
 s[2] = 'd';                     // undefined behaviour?
}

void workerFunc() {
  s = cast(shared)l;
}





Reply via email to