readerLock_.signalWaiters(); if (ie != null) throw new RuntimeException("Lock interrupted, " + ie); else return false; // timed out
readerLock_.signalWaiters(); if (ie != null) throw new RuntimeException("Lock interrupted, " + ie); else return false; // timed out
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); } }