Re: overload lock command? maybe others?
- From: Barry Kelly <barry.j.kelly@xxxxxxxxx>
- Date: Thu, 15 Mar 2007 19:31:43 +0000
not_a_commie wrote:
Barry Kelly wrote:
using (MyLock.Lock(foo)) ...
Thank you, Barry, very much. That was exactly what I needed to know. I
had not heard of the Monitor class, but that looks to be exactly what
I needed.
I can't see how this would apply to try/catch.
The second approach I listed, the delegate approach, can easily be
applied to try/catch. You pass the code as an anonymous delegate as an
argument.
It's too bad that the
try/catch stuff has to go all the way to the OS level to stop from
executing code.
I typically implement my event handlers inside anonymous delegates
passed to wrappers, as indicated in my grandparent post.
Alternatively, you can add a handler to either:
1) Application.ThreadException - for exceptions thrown during Windows
message processing, typically due to e.g. throwing an exception in a
control's event handler.
2) AppDomain.UnhandledException - for those exceptions that would
otherwise fall off the entire thread's stack.
-- Barry
--
http://barrkel.blogspot.com/
.
- References:
- overload lock command? maybe others?
- From: not_a_commie
- Re: overload lock command? maybe others?
- From: Barry Kelly
- Re: overload lock command? maybe others?
- From: Barry Kelly
- Re: overload lock command? maybe others?
- From: not_a_commie
- overload lock command? maybe others?
- Prev by Date: Re: Exception handling suggestions
- Next by Date: Re: Passing data between C# applications
- Previous by thread: Re: overload lock command? maybe others?
- Next by thread: help with error 0x80070005 E_ACCESSDENIED when using TransactionScope
- Index(es):
Relevant Pages
|