HighTechTalks DotNet Forums  

exception inside lock before lock body

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss exception inside lock before lock body in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Daniel
 
Posts: n/a

Default exception inside lock before lock body - 12-08-2005 , 08:12 PM






exception inside lock before lock body

lock(foo()){bar();} what will happen if foo() throws an exception? will
there be a lock on the exception?



Reply With Quote
  #2  
Old   
Alvin Bruney - ASP.NET MVP
 
Posts: n/a

Default Re: exception inside lock before lock body - 12-09-2005 , 12:35 PM






no, you cant lock a function either but assuming you locked an object and an
exception occurred, the object would not be unlocked. One good approach to
fighting this problem is to use a finally block and release or unlock
resources.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



"Daniel" <softwareengineer98037 (AT) yahoo (DOT) com> wrote

Quote:
exception inside lock before lock body

lock(foo()){bar();} what will happen if foo() throws an exception? will
there be a lock on the exception?





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.