Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / abort-stress-1.cs
1 //
2 // This is:
3 //
4 // http://bugzilla.ximian.com/show_bug.cgi?id=72741
5 //
6
7 using System;
8 using System.Threading;
9
10 class T {
11         static int loops = 20;
12         static int threads = 100;
13
14         static void worker () {
15                 while (true)
16                         Thread.Sleep (10);
17         }
18
19         static void doit () {
20                 Thread[] ta = new Thread [threads];
21                 for (int i = 0; i < threads; ++i) {
22                         ta [i] = new Thread (new ThreadStart (worker));
23                         ta [i].Start ();
24                 }
25                 for (int i = 0; i < threads; ++i) {
26                         ta [i].Abort ();
27                 }
28         }
29         static void Main (string[] args) {
30                 if (args.Length > 0)
31                         loops = int.Parse (args [0]);
32                 if (args.Length > 1)
33                         threads = int.Parse (args [1]);
34                 for (int i = 0; i < loops; ++i) {
35                         Console.Write ('.');
36                         doit ();
37                 }
38         }
39 }
40