summaryrefslogtreecommitdiff
path: root/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
diff options
context:
space:
mode:
authorAditya Mandaleeka <adityam@microsoft.com>2016-03-07 15:16:27 -0800
committerAditya Mandaleeka <adityam@microsoft.com>2016-03-19 20:56:14 -0700
commit51033e700c1fb5854962f1f31ebc4b144d5d49d7 (patch)
tree89eae979f459fb1a0c59d9b306c8f9afd40c91f0 /tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
parent586ce538403c1b859f73d97abec9bb4bfad4cab7 (diff)
downloadcoreclr-51033e700c1fb5854962f1f31ebc4b144d5d49d7.tar.gz
coreclr-51033e700c1fb5854962f1f31ebc4b144d5d49d7.tar.bz2
coreclr-51033e700c1fb5854962f1f31ebc4b144d5d49d7.zip
Open source more threading tests.
Diffstat (limited to 'tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs')
-rw-r--r--tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
new file mode 100644
index 0000000000..ff47944833
--- /dev/null
+++ b/tests/src/baseservices/threading/mutex/openexisting/openmutexneg8.cs
@@ -0,0 +1,41 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Threading;
+
+class OpenMutexNeg
+{
+ public Mutex mut;
+
+ public static int Main()
+ {
+ OpenMutexNeg omn = new OpenMutexNeg();
+ return omn.Run();
+ }
+
+ private int Run()
+ {
+ int iRet = -1;
+ // open a Mutex, not case specific
+ mut = new Mutex(false, "This is a Mutex that is Case Specific");
+ try
+ {
+ Mutex mut1 = Mutex.OpenExisting("This is a Mutex that is Case specific");
+ }
+ catch (WaitHandleCannotBeOpenedException)
+ {
+ //Expected
+ iRet = 100;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Caught unexpected exception: " +
+ e.ToString());
+ }
+
+ Console.WriteLine(100 == iRet ? "Test Passed" : "Test Failed");
+ return iRet;
+ }
+} \ No newline at end of file