Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyThread implements Runnable {
- private Semaphore lock;
- private int id;
- public MyThread(Semaphore l, int id) {
- this.lock = l;
- this.id = id;
- }
- public void run() {
- lock.sem_wait();
- Oppg4b.resources[lock.getCounter()].do_stuff(id+1);
- lock.sem_signal();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement