Bump external/ikdasm to master.
[mono-project.git] / mono / tests / threadpool-exceptions5.cs
blob1c66ec85311c9863f5e06cb4a8c51981d7b4995f
1 using System;
2 using System.Threading;
4 class Test {
5 static object monitor;
6 static int return_value = 2;
7 static int Main ()
9 monitor = new object ();
10 AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
11 WaitCallback wcb = new WaitCallback ((a) => {
12 Thread.CurrentThread.Abort();
13 });
14 wcb.BeginInvoke (wcb, OnCBFinished, null);
15 lock (monitor) {
16 Monitor.Wait (monitor);
18 Thread.Sleep (1000);
19 return 1;
22 static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
24 string str = e.ExceptionObject.ToString ();
25 if (str.IndexOf ("From the threadpool") != -1)
26 return_value = 3;
27 lock (monitor) {
28 Monitor.Pulse (monitor);
30 Environment.Exit (return_value);
33 static void OnCBFinished (object arg)
35 return_value = 0;
36 throw new Exception ("From OnCBFinished");