Reduce TLS accesses. (#11487)
[mono-project.git] / mono / tests / threadpool-exceptions4.cs
blob5ae4d634e19929c665aacce5f5f76ca3b52aa2cb
1 using System;
2 using System.Threading;
4 class Test {
5 static int Main ()
7 AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
8 WaitCallback wcb = new WaitCallback ((a) => {
9 throw new Exception ("From the threadpoool");
10 });
11 wcb.BeginInvoke (wcb, OnCBFinished, null);
13 // Should not finish, OnUnhandledException exit path is expected to be executed
14 Thread.Sleep (10000);
16 return 2;
19 static void OnCBFinished (object arg)
21 throw new Exception ("From OnCBFinished");
24 static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
26 Environment.Exit (0);