次の間に違いはありますか:
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(); を入れるべきですか?試す前か後か…
助けてくれてありがとう