[Mono-list] How does Monitor.Enter work?

Daniel Hughes trampster at gmail.com
Thu Jul 21 01:03:16 EDT 2011


It is unwise to post sections of the .net source code to this mailing list.
As technically anyone who has seen the dotnet framework code can't
contribute to those parts of the mono project. Seeing as most of the mono
developers read this list you may inadvertently stop them from being able to
further develop mono.

See http://mono-project.com/Contributing for more info about these rules.

On Thu, Jul 21, 2011 at 3:41 PM, Vincent Povirk <madewokherd at gmail.com>wrote:

> mono/metadata/icall-def.h contains references to the implementations
> of internal calls. Apparently, that method is mono_monitor_enter,
> implemented in monitor.c.
>
> On Wed, Jul 20, 2011 at 9:54 PM, imays <imays at naver.com> wrote:
> > I got a question how Monitor.Enter works. I investigated .net framework
> > source code, and it shows this only:
> >
> >        [System.Security.SecurityCritical]  // auto-generated
> >        [ResourceExposure(ResourceScope.None)]
> >        [MethodImplAttribute(MethodImplOptions.InternalCall)]
> >        private static extern void ReliableEnter(Object obj, ref bool
> > lockTaken);
> >
> > I guess Monitor.Enter implementation is platform dependent, so I browsed
> > Mono source code and I gave up :(
> >
> > Yes, a critical section assigned for each System.Object instance may
> solve,
> > but, I don't think the actual Monitor.Lock is written like this, because
> > creating a critical section for each System.Object will cost unlimitedly.
> > (Win32 does not allow billions of critical section objects in a process!)
> >
> > Does anybody know how Monitor.Lock works? Please reply. Thanks in
> advance.
> >
> >
> > --
> > View this message in context:
> http://mono.1490590.n4.nabble.com/How-does-Monitor-Enter-work-tp3682685p3682685.html
> > Sent from the Mono - General mailing list archive at Nabble.com.
> > _______________________________________________
> > Mono-list maillist  -  Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20110721/8d7f92f0/attachment.html 


More information about the Mono-list mailing list