C:\Documents and Settings\01031010262\Desktop\Apresentação_FINAL\Codigo2\DinningPhilsophers\src\Semaphore.java
package DiningPhilosophers;

public class Semaphore
{
        private int s;
        Semaphore()
        {
                s=1;
        }
        
        Semaphore (int i)
        {
                s=i;
        }
        
        public synchronized void Down()
        {
                while(s==0)
                        try {wait();}
                catch (InterruptedException e) { e.printStackTrace();   }
                s--;
                
        }
        
        public synchronized void Up()
        {
                s++;
                notifyAll();
        }

}