public void endWrite ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( readerWaiting != null ) { // some readers are waiting, we unblock them sp = readerWaiting ; readerWaiting = null ; writer = false ; } else if ( writersWaiting != null ) { sp = writersWaiting . removeFirst ( ) ; if ( writersWaiting . isEmpty ( ) ) writersWaiting = null ; // writer stay true } else { // nobody is waiting writer = false ; return ; } } sp . unblock ( ) ; }
To call when the thread leaves the write mode and release this lock point .