Home All Groups Group Topic Archive Search About

a question on ThreadAbortException

Author
24 Feb 2006 6:13 PM
huangyi12
according to my experience, the call of Abort() will make a thread
throw ThreadAbortException  immediately no matter whether the thread is
alertable state or not.
i know Abort() will queue a APC,
and i also know that thread must be alertable state before handle APC
queue.
now i am confused, how Abort() can cause a thread throw
ThreadAbortException even when "while(true) ; " running.

Did you do some magic to managed code ?
I want to know how you do that ?

My project need to run and schedule many scripts written by user (and
user can write code like "while(true) ;"), because the number of
scripts is huge, so i use a single thread running all the scripts.so i
need a function just like Abort() to interrupt the current script (if
time out) and go on to run next script, but i don't know how to
implement that in c/c++.

can you tell me?  thank you so much.

Author
24 Feb 2006 6:15 PM
Mehdi
On 24 Feb 2006 10:13:12 -0800, huangy***@gmail.com wrote:

> according to my experience, the call of Abort() will make a thread
> throw ThreadAbortException  immediately no matter whether the thread is
> alertable state or not.
> i know Abort() will queue a APC,
> and i also know that thread must be alertable state before handle APC
> queue.
> now i am confused, how Abort() can cause a thread throw
> ThreadAbortException even when "while(true) ; " running.
>
> Did you do some magic to managed code ?
> I want to know how you do that ?

You'll learn everything about Abort() and why you should not use it here:
http://www.interact-sw.co.uk/iangblog/2004/11/12/cancellation
Author
25 Feb 2006 7:18 AM
huangyi
i want to know the implementation of Thread.Abort()
thread must be alertable state before handle APC queue,
how can Thread.Abort() make the thread throw exception an any time?

i try to read the source code of cli, but i found it hart to read.

AddThis Social Bookmark Button