[Mono-dev] System.Threading.Monitor::Exit fails in latest trees

Robert Jordan robertj at gmx.net
Fri Mar 5 10:43:20 EST 2010


On 05.03.2010 16:09, Zoltan Varga wrote:
> Hi,
>
>    The documentation says this, but the MS implementation works otherwise.

MS started throwing with 2.0. It didn't throw before, though.

using System;
using System.Threading;

class Test
{
	static object locker = new object ();
	
	static void Main ()
	{
		// throws starting with MS.NET 4.0:
		Monitor.Enter (locker);
		Monitor.Exit (locker);
		Monitor.Exit (locker);

		// throws starting with MS.NET 2.0:
		Monitor.Exit (locker);
		Monitor.Exit (locker);		
	}
}


Robert

>
>                          Zoltan
>
> On Fri, Mar 5, 2010 at 4:02 PM, cpMon<page.cal at gmail.com>  wrote:
>
>>
>>
>> According to the 2.0 .net MS spec, an exception is thrown for
>> System.Threading.Monitor . From them:
>>
>>   Exceptions
>> Exception type  Condition
>>
>> ArgumentNullException
>>
>>
>> The obj parameter is a null reference (Nothing in Visual Basic).
>>
>> SynchronizationLockException
>>
>>
>> The current thread does not own the lock for the specified object.
>>
>> Here's the link:
>> http://msdn.microsoft.com/en-us/library/system.threading.monitor.exit.aspx
>>
>>
>> --
>> View this message in context:
>> http://n4.nabble.com/System-Threading-Monitor-Exit-fails-in-latest-trees-tp1578116p1579687.html
>> Sent from the Mono - Dev mailing list archive at Nabble.com.
>> _______________________________________________
>> 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