title: Check if thread is running
body: <p>When I declare a HANDLE</p>
  
  <pre><code>HANDLE hThread;
  </code></pre>
  
  <p>I make a check to see if the thread is running,</p>
  
  <pre><code>  if (WaitForSingleObject(hThread, 0) == WAIT_OBJECT)
    {
         //Thread is not running.
    }
    else
    {
         hThread = CreateThread(......)
    }
  </code></pre>
  
  <p>But it fails for the first time to check if the thread is running. How can it be done? I think the only thing i need is set the <code>hThread</code> to signaled state somehow.</p>
  
  <h2>Edit</h2>
  
  <p>I have found something like this</p>
  
  <pre><code>hThread = CreateEvent(0, 0, 1, 0); //sets to handle to signaled
  </code></pre>
  
  <p>Do you agree with this?</p>