Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Semaphore igraci = new Semaphore(12);
  2. Semaphore cab = new Semaphore(0);
  3. Semaphore slobodno = new Semaphore(4);
  4. Semaphore lock = new Semaphore(1);
  5. int count = 0;
  6.  
  7. igraci.acquire();
  8.  
  9. lock.acquire();
  10. count++;
  11.  
  12. if(count==4){
  13.  
  14. slobodno.acquire();
  15. cab.release(4);
  16. state.presobleci();
  17. slobodno.release();
  18.  
  19.  
  20. }
  21. lock.release();
  22.  
  23. sportuvanje.acquire(12);
  24. state.sportuvaj();
  25.  
  26. lock.acquire();
  27. count--;
  28.  
  29. if(count==0){
  30. state.slobodnaSala();
  31. igraci.release(12);
  32. }
  33.  
  34. lock.release();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement