Exemplo n.º 1
0
        static void Main(string[] args)
        {
            _tracer = new Tracer();
            MainExample first = new MainExample(_tracer);

            first.Execution();
            ExtraExample second = new ExtraExample(_tracer);

            second.Life();

            Thread deathThread = new Thread(first.Death);

            deathThread.Start();
            Thread breatheThread = new Thread(second.Breathe);

            breatheThread.Start();

            deathThread.Join();
            breatheThread.Join();

            first.Death();
            second.Eat();

            TraceResult result = _tracer.GetTraceResult();

            OutputResults(result);
        }
Exemplo n.º 2
0
        public void Execution()
        {
            _tracer.StartTrace();
            Thread.Sleep(rand.Next(1, 200));

            Thread.Sleep(rand.Next(1, 200));
            _extra.Eat();

            Thread.Sleep(rand.Next(1, 200));
            _tracer.StopTrace();
        }