Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Semaphore igraci = new Semaphore(12);
- Semaphore cab = new Semaphore(0);
- Semaphore slobodno = new Semaphore(4);
- Semaphore lock = new Semaphore(1);
- int count = 0;
- igraci.acquire();
- lock.acquire();
- count++;
- if(count==4){
- slobodno.acquire();
- cab.release(4);
- state.presobleci();
- slobodno.release();
- }
- lock.release();
- sportuvanje.acquire(12);
- state.sportuvaj();
- lock.acquire();
- count--;
- if(count==0){
- state.slobodnaSala();
- igraci.release(12);
- }
- lock.release();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement