linux-packaging-mono/mono/tests/threadpool-exceptions1.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

30 lines
548 B
C#

using System;
using System.Threading;
class Test {
static object monitor;
static int Main ()
{
monitor = new object ();
AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
ThreadPool.QueueUserWorkItem ((a) => {
throw new Exception ("From the threadpoool");
});
lock (monitor) {
Monitor.Wait (monitor);
}
Thread.Sleep (1000);
return 1;
}
static void OnUnhandledException (object sender, UnhandledExceptionEventArgs e)
{
lock (monitor) {
Monitor.Pulse (monitor);
}
Environment.Exit (0);
}
}