title: Multithreading in VS2010
body: <p>I have a C++ DLL created in VS2010. This DLL is responsible for generating a report and sending it to a server. This DLL is called by an another application which actually creates the data. Since sending the file to a server takes some time so, I don't want the calling application to wait till the DLL is busy in sending the file to a server.</p>
  
  <p>To deal with the above-mentioned issue, I want to assign the task of sending file to a server (just one small function) to a separate thread and do not want to wait for this thread to complete (otherwise no benefit). </p>
  
  <pre><code>while(UserShutDownTheApp)
  {
      - Main App Gather Data 
      - Main App Call data management DLL and pass data to it
          - DataManagementDLL: Generate a Report
          - DataManagementDLL: Start a THREAD and Send report to Server by this THREAD. Do not wait for this THREAD to complete
      - Main App finishes this iteration and is going to enter into next iteration.    
  }
  </code></pre>
  
  <p>Since, I do not have control on the main calling application, I can make modifications only inside the DLL. I am confused how should I implement this logic? I mean, what happens if the Thread has not completed the task of sending the file to the server and meanwhile the main calling application has already called this DLL the second time.</p>