public void Dispose()
 {
     if (this.monitor != null)
     {
         this.monitor.Exit();
         this.monitor = null;
     }
 }
 public static UseLockScope UseLock(this ConditionVariable mutex) =>
 new UseLockScope(mutex);
 internal UseLockScope(ConditionVariable monitor)
 {
     Validate.IsNotNull <ConditionVariable>(monitor, "monitor");
     this.monitor = monitor;
     this.monitor.Enter();
 }