Groups | Blog | Home
all groups > dotnet framework > july 2006 >

dotnet framework : Preventing ThreadAbortException.


Carl Daniel [VC++ MVP]
7/31/2006 1:36:04 PM
[quoted text, click to view]

You need a Constrained Execution Region.

http://msdn2.microsoft.com/en-us/library/ms228973(d=ide).aspx

There's a lot of subtlety and a lot of restrictions on using them, but
they're intended to provide a solution to exactly the kind of problem you're
describing.

-cd

Chris Mullins
7/31/2006 3:15:11 PM
[quoted text, click to view]

The only option I know of is the BeginCriticalRegion stuff.

http://msdn2.microsoft.com/en-us/library/system.threading.thread.begincriticalregion.aspx

--
Chris Mullins
http://www.coversant.net/blogs/cmullins

Ken Varn
7/31/2006 4:17:25 PM
Is there any method that I can guarantee execution of a code path within a
thread without a Thread.Abort call interrupting it? I am concerned that a
file write that is done using two calls will not complete if the thread is
aborted before the second call gets a chance to complete.

I thought about setting the priority to highest for the critical calls, but
I was not sure if this would be sufficient or not.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------

Greg Young
7/31/2006 4:49:36 PM
You can look at the safehandle class to see how this is done as well (I
believe it does just this).

Cheers,

Greg Young
MVP - C#
http://codebetter.com/blogs/gregyoung

"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
[quoted text, click to view]

Ken Varn
8/1/2006 4:40:24 PM
What about 1.1 framework?

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@mvps.org.nospam>
[quoted text, click to view]

AddThis Social Bookmark Button