title: How to terminate a managed thread blocked in unmanaged code?
body: <p>I have a managed thread which is waiting, blocked, in an unmanaged code (specifically, it on a call to NamedPipeServerStream.WaitForConnection() which ultimitely calls into unmanaged code, and does <strong>not</strong> offer a timeout).</p>
  
  <p>I want to shut the thread down neatly.</p>
  
  <p>Thread.Abort() has no effect until the code returns to the managed realm, which it won't do until a client makes a connection, which we can't wait for).</p>
  
  <p>I need a way "shock" it out of the unmanaged code; or a way to just kill the thread even while it's in unmanaged land.</p>