当我们声明一个threadvar
变量时,这个变量何时被初始化(即对象被创建)? 它是在第一次变量赋值时发生吗?例如:
threadvar
myThreadVar : string;
......
//inside a thread
...
myThreadVar := 'my value'; // In this point the var will be initialized?
如果在线程设置完变量的值后,我尝试在线程之外使用该变量会发生什么?例如:
//at the main thread (application)
...
//Call the thread;
//thread finishes execution
//thread is destroyed
ShowMessage(myThreadVar); // what happens here?