Exemple #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);
        }
Exemple #2
0
 public Clerk(PostOffice postOffice)
 {
     this.postOffice = postOffice;
     ID = last_id++;
 }
Exemple #3
0
 public Client(PostOffice po)
 {
     this.postOffice = po;
     ID = last_id++;
 }