title: How to stop a blocking call of WSAPoll
body: <p>I have a case to handle. There is one thread calling WSAPoll() to receive data from TCP connection. The code looks like this:</p>
  
  <pre><code>int result = WSAPoll(fdSocket, 1, timeout);
  if (result == 0)
  {
      // time out
  }
  else if (result == -1)
  {
      // socket error
  }
  </code></pre>
  
  <p>If I set timeout to be a negative number, the thread will wait indefinitely. However, I want to make this function return a value, such as 0, directly to this thread if I call a function StopWait() from another thread.</p>
  
  <p>So what can I do to make this work? Add an asynchronous procedure call to this blocking thread through function StopWait() bu the other thread? If it is, what to add can make it return the value I want?</p>
  
  <p>Thanks!</p>