Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2006

Tip: Looking for answers? Try searching our database.

Preventing ThreadAbortException.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ken Varn - 31 Jul 2006 21:17 GMT
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.

Signature

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

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

Carl Daniel [VC++ MVP] - 31 Jul 2006 21:36 GMT
> 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
[quoted text clipped - 4 lines]
> but
> I was not sure if this would be sufficient or not.

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
Greg Young - 31 Jul 2006 21:49 GMT
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

>> Is there any method that I can guarantee execution of a code path within
>> a
[quoted text clipped - 17 lines]
>
> -cd
Ken Varn - 01 Aug 2006 21:40 GMT
What about 1.1 framework?

Signature

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

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

> > 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
[quoted text clipped - 14 lines]
>
> -cd
Chris Mullins - 31 Jul 2006 23:15 GMT
> Is there any method that I can guarantee execution of a code path within a
> thread without a Thread.Abort call interrupting it?

The only option I know of is the BeginCriticalRegion stuff.

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


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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.