示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Otwieramy Pocztę");
            List <Thread> threads    = new List <Thread>();
            PostOffice    postOffice = new PostOffice();

            for (int i = 0; i < 100; i++)
            {
                Client c = new Client(i + 1, postOffice);
                threads.Add(new Thread(c.VisitPost));
            }
            foreach (Thread t in threads)
            {
                t.Start();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Otwieramy Pocztę");
            PostOffice    po        = new PostOffice();
            List <Client> clients   = new List <Client>();
            List <Thread> clientsTh = new List <Thread>();

            for (int i = 0; i < 100; i++)
            {
                Client c = new Client(i, po);
                clients.Add(c);
                clientsTh.Add(new Thread(c.Task));
            }

            Console.WriteLine("Start obsługi klientów");
            foreach (Thread t in clientsTh)
            {
                t.Start();
            }
        }
示例#3
0
 public Client(int id, PostOffice po)
 {
     this.Id         = id;
     this.postOffice = po;
 }