[Mono-bugs] [Bug 51089][Cri] New - A named mutex does not work.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 17 Nov 2003 17:39:58 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ryoung@novell.com.

http://bugzilla.ximian.com/show_bug.cgi?id=51089

--- shadow/51089	2003-11-17 17:39:58.000000000 -0500
+++ shadow/51089.tmp.13352	2003-11-17 17:39:58.000000000 -0500
@@ -0,0 +1,90 @@
+Bug#: 51089
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: System
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: ryoung@novell.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: A named mutex does not work.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. Run the following code.
+
+using System;
+using System.Threading;
+using System.Diagnostics;
+ 
+class MutexTest
+{
+    string name;
+    public static void Main(string [] args)
+    {
+        if (args.Length != 1)
+        {
+            Console.WriteLine("Usage:mutextest.exe (name)");
+            return;
+        }
+ 
+        MutexTest mt = new MutexTest(args[0]);
+ 
+        Thread t1 = new Thread(new ThreadStart(mt.getMutex));
+        Thread t2 = new Thread(new ThreadStart(mt.getMutex));
+        t1.Name = "Thread 1";
+        t2.Name = "Thread 2";
+ 
+        t1.Start();
+        t2.Start();
+ 
+        t1.Join();
+        t2.Join();
+    }
+ 
+    MutexTest(string n)
+    {
+        name = n;
+    }
+ 
+    void getMutex()
+    {
+        bool owned;
+        Mutex m = new Mutex(false, name);
+ 
+        Console.WriteLine(System.Threading.Thread.CurrentThread.Name + "
+Waiting for mutex " + name);
+        m.WaitOne();
+        Console.WriteLine(System.Threading.Thread.CurrentThread.Name + "
+owns the mutex " + name);
+        Console.WriteLine("Press Enter to exit...");
+        Console.ReadLine();
+        m.ReleaseMutex();
+    }
+}
+
+Actual Results:
+The Thread does not block.
+
+
+Expected Results:
+The Thread should block.
+
+
+How often does this happen? 
+every time.
+
+
+Additional Information:
+This works as expected in .NET on windows.