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

cpMon page.cal at gmail.com
Thu Mar 4 09:12:50 EST 2010


I never get a signal when System.Threading.Monitor::Exit gets called too many
times. Further, I traced it down into the mono 2.6.1 code tree, and
mono_monitor_exit is never called. The trampoline generates the code, but
it's never called. Can you provide a quick fix? It seems like a glaring bug.
Attached is the failing source test along with a mono trace.

Thank You,
Cal Page

using System;
using System.Threading;
 
public class HelloWorld
{
	public static Object myMonitor = new Object();
	public static bool ok = false;

	public static void monitorTest()
	{
		Console.WriteLine("calling Enter");

		Monitor.Enter(myMonitor);

		Console.WriteLine("calling Exit");

		Monitor.Exit(myMonitor);

		try {

			Console.WriteLine("calling Exit #2");

			Monitor.Exit(myMonitor);
		} catch ( Exception e ) {
			Console.WriteLine ("caught exception");
			ok = true;
		}
	}

	static public void Main ()
	{
		Console.WriteLine ("Hello Mono World");

		monitorTest();

		if ( !ok ) Console.WriteLine("TEST FAILED");
	}
 
}


Iinteral trace:

** Message: WSAStartup: high version 0x202
** Message: mono_arch_create_monitor_exit_trampoline_full: entry
** Message: mono_arch_create_monitor_enter_trampoline_full: entry
** Message: mono_monitor_enter: (-1218435344) Locking 0x5cff0
** Message: mono_monitor_try_enter_internal: (-1218435344) Trying to lock
object 0x5cff0 (-1 ms)
** Message: mon_new: allocating more monitors: 16
** Message: mono_monitor_enter: (-1218435344) Locking 0x6afc0
** Message: mono_monitor_try_enter_internal: (-1218435344) Trying to lock
object 0x6afc0 (-1 ms)
Hello Mono World
calling Enter
** Message: mono_monitor_enter: (-1218435344) Locking 0x5cff8
** Message: mono_monitor_try_enter_internal: (-1218435344) Trying to lock
object 0x5cff8 (-1 ms)
calling Exit
calling Exit #2
TEST FAILED
** Message: WSACleanup: cleaning up


-- 
View this message in context: http://n4.nabble.com/System-Threading-Monitor-Exit-fails-in-latest-trees-tp1578116p1578116.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list