public ReaderWriterLockAsyncLocker(ReaderWriterLockAsync locker, bool write)
            {
                this.locker = locker;
                this.write  = write;

                // it is important that these never throw exceptions, they shouldn't ever
                // because Interlocked should never throw
                locker.WaitForReadLock();
                if (write)
                {
                    locker.WaitForWriteLock();
                }
            }
 public void Dispose()
 {
     if (locker != null)
     {
         // it is important that these never throw exceptions, they shouldn't ever
         // because Interlocked should never throw
         locker.ReleaseReadLock();
         if (write)
         {
             locker.ReleaseWriteLock();
         }
         locker = null;
     }
 }