title: When to call CloseHandle?
body: <p>I have a Main thread that receives actions that take some time. So i create a thread and delegate the job to it. This execute function is being called by the main thread when it receives jobs. each job implement this execute.</p>
  
  <pre><code>Return_type execute( Arguments_here) {
  
  // if a file read case
  DWORD threadId;
  HANDLE hThread = CreateThread( 
          NULL,                   // default security attributes
          0,                      // use default stack size  
          MyAsyncFileRead,       // thread function name
          details,          // argument to thread function 
          0,                      // use default creation flags 
          &amp;threadId);   // returns the thread identifier
  // else do other work
  }
  </code></pre>
  
  <p>Now since i do not want to wait on the main thread, i do not call WaitForSingleObject. [ my knowledge of windows thread is low. so if this is not required, pardon me ]</p>
  
  <p>If i wait for the thread to close, it would wait my main thread. I do not want to do that.
  So when do i call CloseHandle ?</p>
  
  <p>When one has got like 10 jobs in hand and one creates 10 threads and then wait for all 10 threads to finish, then it looks good to wait_for_multiple_objects and then call CloseHandle on each handle. </p>
  
  <p>But what should i do in this case ? </p>
  
  <p>[ I suppose that this question would be relevant for all OS so tagging them too. ]</p>