public void startRead ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { if ( ! writer ) { // nobody is writing, we can read readers ++ ; return ; } // if someone is writing, we need to wait if ( readerWaiting == null ) readerWaiting = new SynchronizationPoint < NoException > ( ) ; sp = readerWaiting ; readers ++ ; } sp . block ( 0 ) ; }
To call when a thread wants to enter read mode . If the lock point is used in write mode this method will block until it is released .