static void Main(string[] args) { MyThreadObject a = new MyThreadObject(); Thread t = new Thread(ChangeState); t.Start(a); new Thread(ChangeState).Start(a); Console.ReadKey(); }
static void ChangeState(object o) { MyThreadObject m = o as MyThreadObject; while (true) { lock (m) { m.ChangeState(); } } }