一个线程的死锁情况

  private ReadWriteLock readWriteLock;

  private void method(){
        readWriteLock.readLock().lock(); 
        //...       
        readWriteLock.writeLock().lock();//等待readLock释放
        //...
        readWriteLock.writeLock().unlock();
        //...
        readWriteLock.readLock().unlock();//readLock永远不会释放
}

你可能感兴趣的:(锁)