Пример #1
0
 static void PopTest(int n, SafeQueue <int> Queue)
 {
     for (int i = 0; i < n; i++)
     {
         Queue.Pop();
     }
 }
Пример #2
0
        static void PushTest(int n, SafeQueue <int> Queue)
        {
            Random r = new Random();

            for (int i = 0; i < n; i++)
            {
                Queue.Push(r.Next(1, 100));
            }
        }
Пример #3
0
        static void Main(string[] args)
        {
            SafeQueue <int> TestQueue   = new SafeQueue <int>();
            Thread          PushElement = new Thread(() => PopTest(20, TestQueue));
            Thread          PopElement  = new Thread(() => PushTest(20, TestQueue));

            PopElement.Start();
            PushElement.Start();
            Console.ReadLine();
        }