Exemplo n.º 1
0
        public static void Assert(bool cond, string msg)
        {
            if (!cond)
            {
                Barrier.Enter();

                TextMode.Write("Assertion Failed: ");
                TextMode.Write(msg);

                //if (Serial.Initialized)
                //{
                Debug.COM1.WriteLine("");
                Debug.COM1.WriteLine("----------------- ");
                Debug.COM1.WriteLine("Assertion Failed: ");
                Debug.COM1.WriteLine(msg);

                Debug.COM1.WriteLine("=============================================================");
                Debug.COM1.WriteLine("Stack Trace:");

                ExceptionHandling.DumpCallingStack();
                //}
                Panic(msg);

                Barrier.Exit();
            }
        }
        public void BarrierEnterTest()
        {
            var tasks = Enumerable
                        .Range(1, 2)
                        .Select(i => Task.Factory.StartNew(() => { _barrier.Enter(); }))
                        .ToArray();

            var completed = Task.WaitAll(tasks, 10 * 1000);

            Assert.IsTrue(completed);
        }