Esempio n. 1
0
        static void Main(string[] args)
        {
            MyThreadObject a = new MyThreadObject();

            Thread t = new Thread(ChangeState);

            t.Start(a);

            new Thread(ChangeState).Start(a);

            Console.ReadKey();
        }
Esempio n. 2
0
        static void ChangeState(object o)
        {
            MyThreadObject m = o as MyThreadObject;


            while (true)
            {
                lock (m)
                {
                    m.ChangeState();
                }
            }
        }