gpt4 book ai didi

java - lock.lock() 尝试前

转载 作者:太空狗 更新时间:2023-10-29 22:44:21 28 4
gpt4 key购买 nike

<分区>

有什么区别:

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();尝试之前还是之后?...

感谢您的帮助

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com