Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public synchronized void enter(Object item){
- while (count == BUFFER_SIZE)
- Thread.yeild();
- ++count;
- buffer[in] = item;
- in = (in+1) % BUFFER_SIZE;
- }
- public synchronized void remove (){
- Object item;
- while (count == 0)
- Thread.yeild();
- --count;
- item = buffer[out]
- out = (out+1) % BUFFER_SIZE;
- return item
- }
Advertisement
Add Comment
Please, Sign In to add comment