public void startWrite ( ) { SynchronizationPoint < NoException > sp ; synchronized ( this ) { // if nobody is using the resource, we can start writing if ( readers == 0 && ! writer ) { writer = true ; return ; } // someone is doing something, we need to block sp = new SynchronizationPoint < NoException > ( ) ; if ( writersWaiting == null ) writersWaiting = new LinkedList <> ( ) ; writersWaiting . add ( sp ) ; } sp . block ( 0 ) ; }
To call when a thread wants to enter write mode . If the lock point is used in read mode this method will block until it is released .