if (currentWriter!= null && currentWriter.equals(Thread.currentThread())) return; synchronized (documentCV) { numWritersWaiting++; while (numReaders > 0) { try { documentCV.wait(); } catch (InterruptedException ie) { throw new Error("interruped while trying to obtain write lock"); } } numWritersWaiting --; currentWriter = Thread.currentThread(); }
  protected void writeLock()  {    // FIXME: Implement me.  }