Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ee0bc0d176
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (36 sloc) 0.832 kb
using System;
using System.Collections;
using System.Threading;
public class Bridge {
public static int bridges_done;
public object[] links = new object [10];
~Bridge () {
++bridges_done;
}
}
class Driver {
static int Main () {
int count = Environment.ProcessorCount + 2;
var th = new Thread [count];
for (int i = 0; i < count; ++i) {
th [i] = new Thread ( _ =>
{
var lst = new ArrayList ();
for (var j = 0; j < 5 * 1000 * 1000; j++) {
lst.Add (new object ());
if ((j % 9999) == 0)
lst.Add (new Bridge ());
if ((j % 10000) == 0)
new Bridge ();
if ((j % 500000) == 0)
lst = new ArrayList ();
}
});
th [i].Start ();
}
for (int i = 0; i < count; ++i)
th [i].Join ();
GC.Collect (2);
return Bridge.bridges_done > 0 ? 0 : 1;
}
}
Jump to Line
Something went wrong with that request. Please try again.