Re: Safely implementing Thread.Abort

Rhys Weatherley <[email protected]>
Newsgroups gmane.comp.gnu.dotgnu.developer
Organization Southern Storm Software, Pty Ltd
Message-ID <[email protected]>
On Thursday 20 May 2004 06:58 am, Thong (Tum) Nguyen wrote:

> I think this could work...what do you guys think?

You cannot use any approach that requires the method code to be modified after 
it is first generated.  It isn't thread safe: what if another thread is 
executing the method while you are modifying it?  It isn't even thread-safe 
for the thread that you are suspending: if it is suspended while the thread 
was in the middle of executing the NOP, then it will be in an unknown state 
when resumed.

Outputting abort check instructions on every backward branch is OK with me, as 
long as you only do it in programs that use Thread.Abort.  This can be 
detected by the loader (any assembly with a MemberRef to Thread.Abort is a 
candidate).

Cheers,

Rhys.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.