public void ExpChessResult_ExitCode_ChessRace() { ParallelTasks ptasks = new ParallelTasks(); int balance = 0; ptasks.Add("t1", () => { balance++; int dud = balance; }); ptasks.Add("t2", () => { balance--; int dud = balance; }); ptasks.Execute(); }
public void SimpleRace() { ParallelTasks ptasks = new ParallelTasks(); int balance = 0; ptasks.Add("t1", () => { balance++; int dud = balance; }); ptasks.Add("t2", () => { balance--; int dud = balance; }); ptasks.Execute(); }
public void ExpChessResult_ExitCode_ChessDeadlock() { ParallelTasks ptasks = new ParallelTasks(); object sync1 = new object(); object sync2 = new object(); ptasks.Add("t1", () => { lock (sync1) lock (sync2) { } }); ptasks.Add("t2", () => { lock (sync2) lock (sync1) { } }); ptasks.Execute(); }