publpublic synchronized void push(Wotou wt) {
while(index == wt.length) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
this.notify(); //会执行吗
wotou[index] = wt; //会执行吗 index++; //会执行吗 }
while(index == wt.length) {
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
this.notify(); //会执行吗
wotou[index] = wt; //会执行吗 index++; //会执行吗 }
等待队列中,只有这个等待进程,你执行notify就唤醒这个,如果还有其他,那就不一定了,notify随机的进程
run一下就知道了