[Mono-dev] lock source

Robert Jordan robertj at gmx.net
Wed Apr 23 11:24:56 EDT 2008


Hi,

you may want to look at mcs' sources then.

Robert

alcherenga alcherenga wrote:
> Hi Robert,
> I know that lock eventually translates to monitor.enter and monitor.exit. i
> did saw the file you have mentioned , what really i am looking for wherein ,
> i mean in which the "syntatic sugar" get's converted to "monitor .enter
> ....".
> i mean where is the keyword defined .
> thanks
> alcherenga
> 
> 
> On 4/23/08, Robert Jordan <robertj at gmx.net> wrote:
>> alcherenga alcherenga wrote:
>>> hi,
>>> could anyone tell me wherein the c# lock statment is being elemented. I
>> mean
>>> the source file.
>>> i couldn't find it in mscorlib/system.threading folder.
>> The C# block:
>>
>>        lock (foo) {
>>                ...
>>        }
>>
>> is just syntactic sugar for this:
>>
>>        System.Threading.Monitor.Enter (foo);
>>        try {
>>                ...
>>
>>        } finally {
>>                System.Threading.Monitor.Leave (foo);
>>        }
>>
>> So you're looking for the class System.Threading.Monitor.
>>
>> Since you'll find interesting stuff in this file, the next
>> answer will be mono/mono/metadata/monitor.c ;-)
>>
>> Robert
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list