[runtime] Fix DISABLE_REFLECTION_EMIT build.
[mono.git] / mono / tests / delegate1.cs
index e3e02bb386e4c3a78f32e8a67126f20a81c8ee6e..ddfc2dbc05b39cd1427a57e0c4588acf99dd7f18 100644 (file)
@@ -2,13 +2,12 @@ using System;
 using System.Threading;
 using System.Runtime.InteropServices;
 
-namespace Bah {
 class Test {
        delegate int SimpleDelegate (int a);
 
        static int F (int a) {
                Console.WriteLine ("Test.F from delegate: " + a);
-               //Thread.Sleep (2000);
+               Thread.Sleep (200);
                return a;
        }
 
@@ -24,6 +23,7 @@ class Test {
                string state2 = "STATE2";
                string state3 = "STATE3";
                string state4 = "STATE4";
+               int fin = 0;
                
                IAsyncResult ar1 = d.BeginInvoke (1, ac, state1);
                IAsyncResult ar2 = d.BeginInvoke (2, ac, state2);
@@ -41,15 +41,21 @@ class Test {
                }
 
                ar1.AsyncWaitHandle.WaitOne ();
+               if (ar1.IsCompleted) fin++;
                Console.WriteLine ("completed1: " + ar1.IsCompleted);
                ar2.AsyncWaitHandle.WaitOne ();
+               if (ar2.IsCompleted) fin++;
                Console.WriteLine ("completed2: " + ar2.IsCompleted);
                ar3.AsyncWaitHandle.WaitOne ();
+               if (ar3.IsCompleted) fin++;
                Console.WriteLine ("completed3: " + ar3.IsCompleted);
                ar4.AsyncWaitHandle.WaitOne ();         
+               if (ar4.IsCompleted) fin++;
                Console.WriteLine ("completed4: " + ar4.IsCompleted);
-                               
+
+               if (fin != 4)
+                       return 1;
+               
                return 0;
        }
 }
-}