BindingFlags.Public needed here as Exception.HResult is now public in .NET 4.5. This...
[mono.git] / mono / tests / gc-altstack.cs
1 using System;
2 using System.Threading;
3 using System.Collections;
4
5 class T {
6
7         static bool finished = false;
8
9         static void segv () {
10                 while (true) {
11                         if (finished)
12                                 break;
13                         try {
14                                 object o = null;
15                                 o.ToString ();
16                         } catch (NullReferenceException) {
17                         }
18                 }
19         }
20
21         static void Main (string[] args) {
22                 /* Test for running a GC while executing a SIGSEGV handler on an altstack */
23                 Thread t = new Thread (delegate () { 
24                                 segv ();
25                         });
26
27                 t.Start ();
28
29                 for (int i = 0; i < 100000; ++i) {
30                         new ArrayList ();
31                 }
32
33                 finished = true;
34
35                 t.Join ();
36         }
37 }
38