title: Is it possible to abort/cancel a FileStream.Beginread asynchronous read operation
body: <p>I want to control a STM32 microcontroller using the USB interface. Jan Axelson (<a href="http://www.lvr.com/hidpage.htm#MyExampleCode" rel="nofollow">http://www.lvr.com/hidpage.htm#MyExampleCode</a>) has created some applications to show the usage of the USB HID class which is now my base source.</p>
  
  <p>To check if my device has some pending data I have created a thread calling the <code>Filestream.BeginRead()</code> routine. Now I want to abort/cancel this request, because it is still open/blocked after exiting that thread (setting a variable to cancel the thread loop). So I am wondering how to perform a cancellation  this <code>BeginRead()</code> call. Or do you have a better idea how to check for continuous sent data of the USB device?</p>
  
  <pre><code>// USB read data from device thread
  while (boRunThread)
  {
      if (boStopThread)
      {
          // perform clean-up, cancel BeginRead
          // ... Abort(ar)???
      }
      if (botransfer == false)
      {
          botransfer = true;  // Signal pending transfer
          ar = fileStreamDeviceData.BeginRead(inputReportBuffer, 0, inputReportBuffer.Length, callb, inputReportBuffer);
      }
  }
  </code></pre>