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

imays imays at naver.com
Wed Jul 20 22:54:36 EDT 2011


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.


More information about the Mono-list mailing list