This article shows a way to "abort" a non-cooperating thread. More precisely, it can be used to abort some non-cooperating function called from another thread, and return execution to some "friendly" point within that thread. The method described in this article causes an exception to be raised in the target thread (similar to Thread.Abort in .NET).
The methodFirst let's agree on the exception type that we may want to throw. Let's call it ThreadAbort and define it:class ThreadAbort
{
__declspec (noreturn) static void Throw();
public:
static bool RaiseInThread(HANDLE hThread);
static void DontOptimize() throw (...);
};
Read more: Codeproject
The methodFirst let's agree on the exception type that we may want to throw. Let's call it ThreadAbort and define it:class ThreadAbort
{
__declspec (noreturn) static void Throw();
public:
static bool RaiseInThread(HANDLE hThread);
static void DontOptimize() throw (...);
};
Read more: Codeproject
0 comments:
Post a Comment