2007-03-28 Chris Toshok <toshok@ximian.com>
[mono-project.git] / mono / tests / abort-stress-2.cs
blobb637f930f8d204fab365982096b4ef8f94fe21b7
1 //
2 // This is:
3 //
4 // http://bugzilla.ximian.com/show_bug.cgi?id=72740
5 //
7 using System;
8 using System.Threading;
10 class T {
11 static int loops = 20;
12 static int threads = 100;
14 static void worker () {
15 // This hits alot of runtime code.
16 while (true)
17 typeof (object).Assembly.GetTypes ();
20 static void doit () {
21 Thread[] ta = new Thread [threads];
22 for (int i = 0; i < threads; ++i) {
23 ta [i] = new Thread (new ThreadStart (worker));
24 ta [i].Start ();
26 for (int i = 0; i < threads; ++i) {
27 ta [i].Abort ();
30 static void Main (string[] args) {
31 if (args.Length > 0)
32 loops = int.Parse (args [0]);
33 if (args.Length > 1)
34 threads = int.Parse (args [1]);
35 for (int i = 0; i < loops; ++i) {
36 Console.Write ('.');
37 doit ();