public void lock() { //if (Thread.interrupted()) throw new RuntimeException("Lock interrupted", new InterruptedException()); InterruptedException ie = null; synchronized(this) { if (!startWriteFromNewWriter()) { for (;;) { try { WriterLock.this.wait(); if (startWriteFromWaitingWriter()) return; } catch(InterruptedException ex){ cancelledWaitingWriter(); WriterLock.this.notify(); ie = ex; break; } } } } if (ie != null) { // Fall through outside synch on interrupt. // On exception, we may need to signal readers. // It is not worth checking here whether it is strictly necessary. readerLock_.signalWaiters(); throw new RuntimeException("Lock interrupted, " + ie); } }
public void lock() { //if (Thread.interrupted()) throw new RuntimeException("Lock interrupted", new InterruptedException()); InterruptedException ie = null; synchronized(this) { if (!startWriteFromNewWriter()) { for (;;) { try { WriterLock.this.wait(); if (startWriteFromWaitingWriter()) return; } catch(InterruptedException ex){ cancelledWaitingWriter(); WriterLock.this.notify(); ie = ex; break; } } } } if (ie != null) { // Fall through outside synch on interrupt. // On exception, we may need to signal readers. // It is not worth checking here whether it is strictly necessary. readerLock_.signalWaiters(); throw new RuntimeException("Lock interrupted, " + ie); } }
if (msecs <= 0) return startWrite(); else if (startWriteFromNewWriter()) return true; else {
if (msecs <= 0) return startWrite(); else if (startWriteFromNewWriter()) return true; else {