2 using System
.Threading
;
9 monitor
= new object ();
10 AppDomain
.CurrentDomain
.UnhandledException
+= OnUnhandledException
;
11 WaitCallback wcb
= new WaitCallback ((a
) => {
12 throw new Exception ("From the threadpoool");
14 wcb
.BeginInvoke (wcb
, OnCBFinished
, null);
16 Monitor
.Wait (monitor
);
22 static void OnCBFinished (object arg
)
24 throw new Exception ("From OnCBFinished");
27 static void OnUnhandledException (object sender
, UnhandledExceptionEventArgs e
)
30 Monitor
.Pulse (monitor
);