Yep, I definitely think you're right.  I had the same idea a little while ago, and I'm 
glad that
at least I'm not so stupid that it didn't hit me eventually.  I now feel confident 
sending my
friend an update, thanks to your letter (I don't have a Linux machine to test on right 
now).  I
didn't know that use of "lock" translates to the same code as Monitor calls, but 
thanks very much
for the information.  I apologize for wasting people's time!  I will think a lot 
harder next time,
and not mix the calls

Jeff

--- Jonathan Perret <[EMAIL PROTECTED]> wrote:
> > The code in question is pretty detailed, but the synchronization scheme
> boils down to this: I have
> > two overlapping (avoiding the word "interlocked") synchronized regions,
> where I start, the first,
> > start the second, exit the first, then exit the second, like this:
> >
> > object monitor1 = new object();
> > object monitor2 = new object();
> > lock (monitor1) {
> >    // ...
> >    lock (monitor2) {
> >       Monitor.Exit(monitor1);
> >       // ...
> >    }
> > }
>
> Jeff, I think the exception is thrown at the exit of the lock(monitor1)
> block.
> You are certainly aware that lock() { } is a shorthand for
> try { Monitor.Enter() ...}finally { Monitor.Exit() }.
> It follows that monitor1 is in fact exited twice, which apparently .net
> endures silently while Mono does not.
> You really should not mix lock() and Monitor.Enter/Exit.
>
> HTH,
> --Jonathan
>
> ===================================
> This list is hosted by DevelopMentorŪ  http://www.develop.com
> NEW! ASP.NET courses you may be interested in:
>
> 2 Days of ASP.NET, 29 Sept 2003, in Redmond
> http://www.develop.com/courses/2daspdotnet
>
> Guerrilla ASP.NET, 13 Oct 2003, in Boston
> http://www.develop.com/courses/gaspdotnet
>
> View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to