2 using System
.Threading
;
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
)
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)
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
++) {
37 if (allocs
[i
] != reps
)