[interp] disable some tests that fail on CI only
[mono.git] / mono / tests / threadpool-exceptions2.cs
1 using System;
2 using System.Threading;
3
4 class Test {
5         static object monitor;
6         static int return_value = 2;
7
8         static int Main ()
9         {
10                 monitor = new object ();
11                 AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
12                 WaitCallback wcb = new WaitCallback ((a) => {
13                         throw new Exception ("From the threadpoool");
14                 });
15                 wcb.BeginInvoke (wcb, OnCBFinished, null);
16                 lock (monitor) {
17                         Monitor.Wait (monitor);
18                 }
19                 Thread.Sleep (1000);
20                 return 1;
21         }
22
23         static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
24         {
25                 string str = e.ExceptionObject.ToString ();
26                 if (str.IndexOf ("From the threadpool") != -1)
27                         return_value = 3;
28                 lock (monitor) {
29                         Monitor.Pulse (monitor);
30                 }
31                 Environment.Exit (return_value);
32         }
33
34         static void OnCBFinished (object arg)
35         {
36                 return_value = 0;
37                 throw new Exception ("From OnCBFinished");
38         }
39 }
40