Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. public class Produttore implements Runnable {
  2.  
  3. private Buffer b;
  4. private Semaforo sp,sc;
  5.  
  6. public Produttore(Buffer b, Semaforo sp, Semaforo sc) {
  7. super();
  8. this.b = b;
  9. this.sp = sp;
  10. this.sc = sc;
  11. }
  12.  
  13.  
  14. @Override
  15. public void run() {
  16. for(int i=0; i<10; i++)
  17. {
  18. sp.P(); //aspetta il verde e poi lo mette a rosso
  19. b.put(i);
  20. sc.V(); //mette il semaforo verde
  21. }
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement