其他分享
首页 > 其他分享> > Lock锁

Lock锁

作者:互联网

 ReentrantLock vs synchronized

public class ReentrantLockTest {
    public static void main(String[] args) {
        Lock lock = new ReentrantLock();
        try {
            lock.lock();
        } finally {
            lock.unlock();
        }
    }
}

 

标签:synchronized,Lock,代码,ReentrantLock,lock,public
来源: https://www.cnblogs.com/jzbl/p/16388121.html