C
chook.harel
I've read the articles by MSDN and the topics here,
but still I haven't found a good way to abort a thread,
My problem is that the thread i'm trying to close is calling an
external function
and i'm counting 10 seconds in the main thread, if it didn't changed
a flag in those 10 seconds, it means it stuck and i need to terminate
it.
if it got an answer.. then everything is ok.. but still i wants to
close that thread.
If it stucks then the next time i'll try it it will raise a runtime
error which i can't catch
so there I'm stuck right now :/
What can I do to kill the thread i've opened
i've also tried
while (!thread.Join(100))
{
Console.WriteLine("Thread not aborted, trying
again.");
thread.Abort();
}
it didn't help.
but still I haven't found a good way to abort a thread,
My problem is that the thread i'm trying to close is calling an
external function
and i'm counting 10 seconds in the main thread, if it didn't changed
a flag in those 10 seconds, it means it stuck and i need to terminate
it.
if it got an answer.. then everything is ok.. but still i wants to
close that thread.
If it stucks then the next time i'll try it it will raise a runtime
error which i can't catch
so there I'm stuck right now :/
What can I do to kill the thread i've opened
i've also tried
while (!thread.Join(100))
{
Console.WriteLine("Thread not aborted, trying
again.");
thread.Abort();
}
it didn't help.