Example #1
0
        public static bool doit()
        {
            MonitorSample sample = new MonitorSample();
            Thread        child  = new Thread(delegate(object o) {
                MonitorSample s = (MonitorSample)o;
                for (int i = 5; i < 10; i++)
                {
                    s.AddElement(i);
                }
            });
            Thread child2 = new Thread(delegate(object o) {
                MonitorSample s = (MonitorSample)o;
                for (int i = 0; i < 5; i++)
                {
                    s.AddElement(i);
                }
            });

            child.Start(sample);
            child2.Start(sample);
            child.Join();
            child2.Join();
            for (int i = 0; i < 10; i++)
            {
                sample.DeleteElement(i);
            }
            return(sample.IsEmpty());
        }
Example #2
0
 public static bool Run()
 {
     return(MonitorSample.doit());
 }