Files
changeTest/ConditionDemo/src/ConditionDemo.java
2021-03-02 19:53:52 +01:00

23 lines
555 B
Java

// Running the world
//
public class ConditionDemo {
public static void main(String[] args) throws InterruptedException {
SharedFiFoQueue sharedQueue = new SharedFiFoQueue(10);
//Create a producer and a consumer.
Thread producer = new Producer(sharedQueue);
Thread consumer = new Consumer(sharedQueue);
//Start both threads.
producer.start();
consumer.start();
//Wait for both threads to terminate.
producer.join();
consumer.join();
}
}