title: Delphi threadvar question
body: <p>When we have a <code>threadvar</code> declared, when this variable will be initialized (the object is created)? Does it occurs at the first assignment of the var? For example:</p>
  
  <pre><code>threadvar
    myThreadVar : string;
  
  ......
  
  //inside a thread
    ...
    myThreadVar := 'my value'; // In this point the var will be initialized?
  </code></pre>
  
  <p>What happens if I try to use this var outside a thread after the thread has set the value for the var? For example:</p>
  
  <pre><code>//at the main thread (application)
    ...
    //Call the thread;
    //thread finishes execution
    //thread is destroyed
    ShowMessage(myThreadVar); // what happens here?
  </code></pre>