<分区>
有什么区别:
private Lock lock = new ReentrantLock(true);
public void getIn (int direction) throws InterruptedException {
lock.lock();
try {
...
和
...
public void getIn (int direction) throws InterruptedException {
try {
lock.lock();
...
编译顺利,程序运行正常(我的意思是相同的输出)
我应该把 lock.lock();尝试之前还是之后?...
感谢您的帮助