[CI] ignore appdomain-unload-asmload.exe on interp and full-aot
[mono.git] / mono / tests / threadpool-exceptions2.cs
index 0b12a809db37a6bf14a5c44c39f7259f4a03795a..c0b7510aa45585b86d167431633a4e60771212dd 100644 (file)
@@ -2,14 +2,20 @@ 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) => {
                        throw new Exception ("From the threadpoool");
                });
                wcb.BeginInvoke (wcb, OnCBFinished, null);
+               lock (monitor) {
+                       Monitor.Wait (monitor);
+               }
                Thread.Sleep (1000);
                return 1;
        }
@@ -19,6 +25,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);
        }