C# Monitor Wait & PulseAll
\nusing System.Threading; \n\npublic class Foo\n    {\n        class Lock\n        {\n           public int Step;\n        }\n\n        static Lock _Lock = new 
```\nusing System.Threading; \n\npublic class Foo\n    {\n        class Lock\n        {\n           public int Step;\n        }\n\n        static Lock _Lock = new Lock(){ Step = 0 };\n\n        public Foo()\n        {\n\n        }\n\n        public void First(Action printFirst)\n        {\n            lock (_Lock)\n            {\n                // printFirst() outputs "first". Do not change or remove this line.\n                printFirst();\n                _Lock.Step = 1;\n                Monitor.PulseAll(_Lock);\n            }\n        }\n\n        public void Second(Action printSecond)\n        {\n            lock (_Lock)\n            {\n                while (_Lock.Step!= 1)\n                {\n                    Monitor.Wait(_Lock);\n                }\n                // printSecond() outputs "second". Do not change or remove this line.\n                printSecond();\n                _Lock.Step = 2;\n                Monitor.PulseAll(_Lock);\n            }\n        }\n\n        public void Third(Action printThird)\n        {\n            lock (_Lock)\n            {\n                while(_Lock.Step!=2)\n                {\n                    Monitor.Wait(_Lock);\n                }\n                // printThird() outputs "third". Do not change or remove this line.                \n                printThird();\n                _Lock.Step = 3;\n                Monitor.PulseAll(_Lock);\n            }\n        }\n    }\n```
[]