전.java
생산자, 소비자 (환형 큐, 버퍼 크기 2)
# 소스 class CircularQueue{ private int contents[], size; private int head, tail; private int count; public CircularQueue(int sz) { size = sz; head = tail = 0; count = 0; contents = new int[size]; } public synchronized int get(String name) { int res; while (count == 0) try { wait(); } catch (InterruptedException e) {} res = contents[tail]; System.out.println(name + " got: " + contents[tail]); tail..
2021. 1. 27. 20:03