private void SetRegistrationForAcquireWrite(long id, CancellationTokenRegistration ctr)
 {
     lock (syncRoot) {
         if (waitingWrites.ContainsId(id))
         {
             waitingWrites.GetById(id).ctr = ctr;
         }
         else
         {
             ctr.PostDispose();
         }
     }
 }