Hi Everybody,
I have a third party library that contains an error. When I call a function it may hang. The library function is called inside a dll. I de
Unfortunately, you can't arbitrarily terminate a thread safely.
TerminateThread causes the thread to terminate immediately, even if the thread is holding locks or modifying some internal state. TerminateThread can cause random hangs in your application (if the thread was holding a lock) or a crash (if the thread were modifying some state and it is left inconsistent)
If you cannot trust the DLL to behave correctly and this is causing significant reliability issues for you, you should move the code invoking the DLL into a separate process - terminating a process is much safer.