2 using System
.Threading
;
6 const int thread_count
= 10;
7 const int weakrefs_per_thread
= 5000;
8 const int crash_loops
= 5;
9 public static void CrashRound () {
10 var t
= new Thread
[thread_count
];
12 for (int i
= 0; i
< thread_count
; ++i
) {
13 t
[i
] = new Thread (delegate () {
14 for (int j
= 0; j
< weakrefs_per_thread
; ++j
) {
15 new WeakReference (new object ());
17 Interlocked
.Increment (ref fcount
);
21 for (int i
= 0; i
< thread_count
; ++i
)
25 if (fcount
== thread_count
)
32 public static void Main () {
33 for (int i
= 0; i
< crash_loops
; ++i
) {
34 Console
.WriteLine ("{0}", i
);