[runtime] Remove all NACL support. It was unmaintained for a long time. (#4955)
[mono.git] / mono / tests / sgen-suspend.cs
1 using System;
2 using System.Threading;
3
4 /*
5 This test stresses the interaction of the multiple suspend sources and stop-the-world.
6
7 Right now the current iteraction that we stresses is between the domain unloader and
8 sgen STW. It's mighty hard to get this right on mach.
9 */
10
11 class Driver {
12
13         static void AllocStuff ()
14         {
15                 var x = new object ();
16                 for (int i = 0; i < 300; ++i)
17                         x = new byte [i];
18         }
19
20         static void BackgroundNoise ()
21         {
22                 int i = 0;
23                 while (true) {
24                         AllocStuff ();
25                         ++i;
26                 }
27         }
28
29         static void AppDomainBackgroundNoise ()
30         {
31                 for (int i = 0; i < 3; ++i) {
32                         var t = new Thread (BackgroundNoise);
33                         t.IsBackground = true;
34                         t.Start ();
35                 }
36         }
37
38         static void Main () {
39                 for (int i = 0; i < 3; ++i) {
40                         var t = new Thread (BackgroundNoise);
41                         t.IsBackground = true;
42                         t.Start ();
43                 }
44                 
45                 for (int i = 0; i < 100; ++i) {
46                         var ad = AppDomain.CreateDomain ("domain_" + i);
47                         ad.DoCallBack (new CrossAppDomainDelegate (AppDomainBackgroundNoise));
48                         Thread.Sleep (10);
49                         AppDomain.Unload (ad);
50                         Console.Write (".");
51                         if (i > 0 && i % 20 == 0) Console.WriteLine ();
52                 }
53                 Console.WriteLine ("\ndone");
54         }
55 }