2 using System.Threading;
6 static int threads = 100;
8 static void worker () {
9 /* a writeline happens to involve lots of code */
10 Console.WriteLine ("Thread start " + Thread.CurrentThread.GetHashCode ());
14 Thread[] ta = new Thread [threads];
15 for (int i = 0; i < threads; ++i) {
16 ta [i] = new Thread (new ThreadStart (worker));
19 for (int i = 0; i < threads; ++i) {
23 static void Main (string[] args) {
25 loops = int.Parse (args [0]);
27 threads = int.Parse (args [1]);
28 for (int i = 0; i < loops; ++i) {