Waitany test debug and cleanup
authorSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>
Thu, 7 Jun 2018 22:59:31 +0000 (18:59 -0400)
committerSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>
Thu, 7 Jun 2018 22:59:40 +0000 (18:59 -0400)
13 files changed:
tests/src/baseservices/threading/waithandle/waitany/waitanyex1.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex10.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex10a.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex3.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex3a.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex5.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex5a.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex6.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex7.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex7a.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex8.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex9.cs
tests/src/baseservices/threading/waithandle/waitany/waitanyex9a.cs

index b55f8a0..46d43a8 100644 (file)
@@ -35,7 +35,7 @@ class WaitAnyEx
             Console.WriteLine("Waiting...");
             int i = WaitHandle.WaitAny(
                 new WaitHandle[]{myMutex,
-                new ManualResetEvent(false)}, 10000);
+                new ManualResetEvent(false)}, 30000);
             Console.WriteLine("WaitAny did not throw an " +
                 "exception, i = " + i);
         }
index bb13264..48e344f 100644 (file)
@@ -78,10 +78,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexesWait()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
             else
                 ((ManualResetEvent)w).Set();
@@ -101,4 +100,4 @@ class WaitAnyEx
                 wh[i] = new ManualResetEvent(false);
         }
     }
-}
\ No newline at end of file
+}
index b92f819..c3157d7 100644 (file)
@@ -78,10 +78,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexesWait()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
             else
                 ((ManualResetEvent)w).Set();
@@ -101,4 +100,4 @@ class WaitAnyEx
                 wh[i] = new ManualResetEvent(false);
         }
     }
-}
\ No newline at end of file
+}
index e1160c5..fe81733 100644 (file)
@@ -29,7 +29,7 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh, 10000);
+            int i = WaitHandle.WaitAny(wh, 30000);
             Console.WriteLine("WaitAny did not throw an " +
                 "exception, i = " + i);
         }
@@ -49,10 +49,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexes()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
index f79cfa5..da03f08 100644 (file)
@@ -49,10 +49,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexes()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
@@ -78,4 +77,4 @@ class WaitAnyEx
             }
         }
     }
-}
\ No newline at end of file
+}
index cdd75e5..6d73ec6 100644 (file)
@@ -30,8 +30,8 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            i = WaitHandle.WaitAny(wh, 5000);
-            Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+            i = WaitHandle.WaitAny(wh, 30000);
+            Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
         }
         catch(AbandonedMutexException)
         {
@@ -49,11 +49,10 @@ class WaitAnyEx
 
     private void AbandonOneAndRelease()
     {
-        Mutex m = new Mutex();
         bool bSet = false;
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
             {
                 w.WaitOne();
                 if(bSet)
index 16c4e50..b3d29fb 100644 (file)
@@ -31,7 +31,7 @@ class WaitAnyEx
         {
             Console.WriteLine("Waiting...");
             i = WaitHandle.WaitAny(wh);
-            Console.WriteLine("WaitAny did not throw AbandonedMutexExcpetion");
+            Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
         }
         catch(AbandonedMutexException)
         {
@@ -49,11 +49,10 @@ class WaitAnyEx
 
     private void AbandonOneAndRelease()
     {
-        Mutex m = new Mutex();
         bool bSet = false;
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
             {
                 w.WaitOne();
                 if(bSet)
index 0f5b586..181e0c5 100644 (file)
@@ -55,13 +55,17 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            i = WaitHandle.WaitAny(wh, 5000);
             if(0 == iPosToAbandon)
-                Console.WriteLine("WaitAny didn't return an " +
-                    "AbandonedMutexException");
+            {
+                i = WaitHandle.WaitAny(wh, 30000);
+                Console.WriteLine("WaitAny did not throw AbandonedMutexException. Result: {0}", i);
+            }
             else
+            {
+                i = WaitHandle.WaitAny(wh, 10000);
                 // Expected to pass
                 iRet = 100;
+            }
         }
         catch(AbandonedMutexException)
         {
@@ -94,4 +98,4 @@ class WaitAnyEx
             wh[i] = new Mutex(false, Common.GetUniqueName());
         }
     }
-}
\ No newline at end of file
+}
index cc3108d..74e56be 100644 (file)
@@ -28,7 +28,7 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh, 10000);
+            int i = WaitHandle.WaitAny(wh, 30000);
             Console.WriteLine("WaitAny did not throw an " +
                 "exception, i = " + i);
         }
@@ -48,10 +48,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexes()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
index 903b83c..736ce14 100644 (file)
@@ -48,10 +48,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexes()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
index 358ae51..2239835 100644 (file)
@@ -34,7 +34,7 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh, 5000);
+            int i = WaitHandle.WaitAny(wh, 30000);
             Console.WriteLine("WaitAny did not throw an " +
                 "exception, i = " + i);
         }
index 76b3006..7af9135 100644 (file)
@@ -58,7 +58,7 @@ class WaitAnyEx
         try
         {
             Console.WriteLine("Waiting...");
-            int i = WaitHandle.WaitAny(wh, 10000);
+            int i = WaitHandle.WaitAny(wh, 30000);
             Console.WriteLine("WaitAny did not throw an " +
                 "exception, i = " + i);
         }
@@ -78,10 +78,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexesWait()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
@@ -99,4 +98,4 @@ class WaitAnyEx
                 wh[i] = new ManualResetEvent(false);
         }
     }
-}
\ No newline at end of file
+}
index 1c5817f..38637a9 100644 (file)
@@ -78,10 +78,9 @@ class WaitAnyEx
 
     private void AbandonAllMutexesWait()
     {
-        Mutex m = new Mutex();
         foreach(WaitHandle w in wh)
         {
-            if(w.GetType() == m.GetType())
+            if(w is Mutex)
                 w.WaitOne();
         }
         myMRE.Set();
@@ -99,4 +98,4 @@ class WaitAnyEx
                 wh[i] = new ManualResetEvent(false);
         }
     }
-}
\ No newline at end of file
+}