[Mono-dev] lock source

Robert Jordan robertj at gmx.net
Wed Apr 23 07:59:29 EDT 2008


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



More information about the Mono-devel-list mailing list