This repository has been archived on 2021-10-31. You can view files and clone it, but cannot push or open issues or pull requests.
PF3/hw1/Ex2/src/semaphore/ValetSimulation.java

22 lines
377 B
Java

package semaphore;
public class ValetSimulation implements Runnable {
private final Queue<Car> valetQueue;
public ValetSimulation(Queue<Car> valetQueue) {
this.valetQueue = valetQueue;
}
public void run() {
while (true) {
try {
Car car = valetQueue.take();
car.park();
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
}
}