Advertisement
Guest User

Untitled

a guest
Nov 20th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. public class MyThread implements Runnable {
  2. private Semaphore lock;
  3. private int id;
  4. public MyThread(Semaphore l, int id) {
  5. this.lock = l;
  6. this.id = id;
  7. }
  8. public void run() {
  9. lock.sem_wait();
  10. Oppg4b.resources[lock.getCounter()].do_stuff(id+1);
  11. lock.sem_signal();
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement