[Mono-list] yield

Miguel de Icaza miguel at ximian.com
Fri Sep 23 18:38:41 EDT 2005


Hello,

> Miguel de Icaza wrote:
> >     Would you mind sending me the IL output for the lock inside yield
> > using the August CTP? 
> 
> Attached is a zip with source and resulting dll.

You are right, I miss-read the IL output that I had on my machine.  

We do generate the same code, it is correct (and I was wrong).

That being said, you should still stay away from yields inside locks
unless you really know what you are doing.

I noticed something cute though: we (and MS) produce the "Monitor.Exit"
call on the generated Dispose method which might be a way of releasing
the lock.

I was quite surprised that we implemented this feature, and looking
through the logs it was Martin Baulig which got the Dispose semantics in
place.

Miguel.


More information about the Mono-list mailing list