예제 #1
0
        public static void Main()
        {
            int        noOfClients = 1000;
            int        noOfClerks  = 3;
            PostOffice po          = new PostOffice(noOfClerks);

            for (int i = 0; i < noOfClients; i++)
            {
                Client c  = new Client(po);
                Thread th = new Thread(new ThreadStart(c.goToPost));
                th.Start();
            }
            Console.WriteLine("Otwieramy wszystkie okienka");
            po.semaphore.Release(noOfClerks);
        }
예제 #2
0
 public Clerk(PostOffice postOffice)
 {
     this.postOffice = postOffice;
     ID = last_id++;
 }
예제 #3
0
 public Client(PostOffice po)
 {
     this.postOffice = po;
     ID = last_id++;
 }