Example #1
0
        static void Main(string[] args)
        {
            char[,] matrix = GetMatrix();


            Thread T1 = new Thread(Search);

            T1.Name = "1-й разведчик";

            Thread T2 = new Thread(Search);

            T2.Name = "2-й разведчик";

            Thread T3 = new Thread(Search);

            T3.Name = "3-й разведчик";

            Scout scout1 = new Scout(T1.Name);
            Scout scout2 = new Scout(T2.Name);
            Scout scout3 = new Scout(T3.Name);

            T1.Start(scout1);
            T2.Start(scout2);
            T3.Start(scout3);
        }
Example #2
0
        private static void Search(object x)
        {
            Scout scout = (Scout)x;

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    mutexJbj.WaitOne();



                    mutexJbj.ReleaseMutex();
                }
            }
        }