[System] Use GZipStream from corefx
[mono-project.git] / mono / tests / test-tls.cs
blobcfa31f581f16bead95c531d23e133e88e36a957c
1 using System;
2 using System.Threading;
4 public class Program
6 public const int nr_threads = 4;
7 public const int reps = 10000;
8 public static int[] allocs = new int[nr_threads];
10 public Program (int index)
12 allocs [index] += 1;
15 public static void Work (object oindex)
17 int index = (int)oindex;
18 for (int i = 0; i < reps; i++) {
19 Thread thread = Thread.CurrentThread;
20 if (string.Compare (thread.Name, "t" + index) == 0)
21 new Program (index);
25 public static int Main (string[] args)
27 Thread[] threads = new Thread[nr_threads];
29 for (int i = 0; i < nr_threads; i++) {
30 threads [i] = new Thread (Work);
31 threads [i].Name = "t" + i;
32 threads [i].Start (i);
35 for (int i = 0; i < nr_threads; i++) {
36 threads [i].Join ();
37 if (allocs [i] != reps)
38 return 1;
41 return 0;