title: boost::thread not updating global variable
body: <p>I am using a wrapper function in an external software to start a new thread, which updates a global variable, but yet this seems invisible to the main thread. I cant call join(), not to block the main thread and crash the software. boost::async, boost::thread and boost::packaged_task all behave the same way. </p>
  
  <pre><code>uint32 *Dval;
  
  bool hosttask1()
  {
  
          while(*Dval&lt;10)
          {
              ++*Dval;
              PlugIn::gResultOut &lt;&lt; " within thread global value: " &lt;&lt; *Dval &lt;&lt; std::endl;    
              Sleep(500);
          }
  
  
  return false;
  }
  
  
  
  void SU_HostThread1(uint32 *value)
  {
  
  Dval = value; 
  *Dval = 2;
  PlugIn::gResultOut &lt;&lt; " before thread: " &lt;&lt; *value &lt;&lt;  " before thread global: " &lt;&lt; *Dval &lt;&lt; std::endl;
  
      auto myFuture = boost::async(boost::launch::async,&amp;hosttask1);
  
      //boost::thread thread21 = boost::thread(&amp;hosttask1);
      //boost::packaged_task&lt;bool&gt; pt(&amp;hosttask1);
      //boost::thread thread21 = boost::thread(boost::move(pt)); 
  }
  </code></pre>
  
  <p>When I call the function:</p>
  
  <pre><code>number a=0 
  su_hostthread1(a)
  sleep(2) //seconds
  result(" function returned "+a+"  \n")
  
  OUTPUT:
  
  before thread value: 2 before thread global value: 2
   within thread global value: 3
   within thread global value: 4
   within thread global value: 5
   within thread global value: 6
   function returned 2  
   within thread global value: 7
   within thread global value: 8
   within thread global value: 9
   within thread global value: 10
  </code></pre>
  
  <p>Any ideas?
  Thanks in advance!</p>