public static void NoLock(int NumberIterations) { IntAdd ia = new IntAdd(); for (int i = 0; i < NumberIterations; ++i) { ++ia.Data; } }
public static void Synch(int NumberIterations) { IntAdd ia = new IntAdd(); ia = IntAdd.Synchronized(ia); for (int i = 0; i < NumberIterations; ++i) { ++ia.Data; } }
internal SynchIntAdd(IntAdd parent) { _parent = parent; _root = parent.SyncRoot; }