Skip to content

Instantly share code, notes, and snippets.

@MarounMaroun
Last active April 19, 2016 10:48
Show Gist options
  • Select an option

  • Save MarounMaroun/34e55a133ba5548f8a6e895bb6125db8 to your computer and use it in GitHub Desktop.

Select an option

Save MarounMaroun/34e55a133ba5548f8a6e895bb6125db8 to your computer and use it in GitHub Desktop.
Runs a simulation of producer-consumer pattern
public class Main {
public static void main(String[] args) {
Data d = new Data();
Thread p1 = new Thread(new Producer(d, 1));
Thread c1 = new Thread(new Consumer(d, 1));
Thread c2 = new Thread(new Consumer(d, 2));
p1.start();
c1.start();
c2.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment