This is somewhat related to this thread, but a different question.
If I P/Invoke into unmanaged code and it gets hung, how can I kill the thread? This will obviously need to happen from a different thread. However, Thread.Abort does not work because the documentation states that the thread will only throw the ThreadAbortException once it returns from unmanaged code.
So far the only way that I found to kill a hung thread is to kill the whole process via Process.Kill. But that is way overkill for what I want, and I am hoping there is a better way that allows me to kill just the thread itself.