[runtime] Fix DISABLE_REFLECTION_EMIT build.
[mono.git] / mono / tests / threadpool-exceptions5.cs
index da9c354b05140bbe49b29b755c400a16eeb63ee5..1c66ec85311c9863f5e06cb4a8c51981d7b4995f 100644 (file)
@@ -2,14 +2,19 @@ using System;
 using System.Threading;
 
 class Test {
+       static object monitor;
        static int return_value = 2;
        static int Main ()
        {
+               monitor = new object ();
                AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
                WaitCallback wcb = new WaitCallback ((a) => {
                        Thread.CurrentThread.Abort();
                });
                wcb.BeginInvoke (wcb, OnCBFinished, null);
+               lock (monitor) {
+                       Monitor.Wait (monitor);
+               }
                Thread.Sleep (1000);
                return 1;
        }
@@ -19,6 +24,9 @@ class Test {
                string str = e.ExceptionObject.ToString ();
                if (str.IndexOf ("From the threadpool") != -1)
                        return_value = 3;
+               lock (monitor) {
+                       Monitor.Pulse (monitor);
+               }
                Environment.Exit (return_value);
        }