Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / assembly-load-stress.cs
1 using System;
2 using System.Text;
3 using System.Globalization;
4 using System.Collections.Generic;
5 using System.Reflection;
6 using System.Threading;
7 using System.IO;
8
9 public class Tests
10 {
11         static int nloops = 1;
12         static int nthreads = 10;
13
14         public static void Main (String[] args) {
15                 if (args.Length > 0)
16                         nloops = int.Parse (args [0]);
17                 if (args.Length > 1)
18                         nthreads = int.Parse (args [1]);
19
20                 for (int li = 0; li < nloops; ++li) {
21                         Thread[] threads = new Thread [nthreads];
22                         for (int i = 0; i < nthreads; ++i) {
23                                 threads [i] = new Thread (delegate () {
24                                                 foreach (string s in Directory.GetFiles ("/usr/local/lib/mono/4.5", "*.dll")) {
25                                                         AssemblyName.GetAssemblyName (s);
26                                                 }
27                                         });
28                         }
29                         for (int i = 0; i < 10; ++i)
30                                 threads [i].Start ();
31                 }
32         }
33 }