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/CarSimulation.java

21 lines
385 B
Java

package semaphore;
public class CarSimulation implements Runnable {
private final Queue<Car> valetQueue;
private final Car car;
public CarSimulation(Queue<Car> valetQueue, Car car) {
this.valetQueue = valetQueue;
this.car = car;
}
public void run() {
try {
valetQueue.put(car);
} catch (InterruptedException e) {
e.printStackTrace();
System.exit(1);
}
}
}