Example #1
0
 public void Dispose()
 {
     _timer.Enabled = false;
     _timer.Dispose();
     if (_lockHandle != null && _autoRelease)
     {
         _log.Information("Releasing lock {LockHandle}", _lockHandle);
         _lockHandle.ReleaseAsync(CancellationToken.None).GetAwaiter().GetResult();
     }
 }
Example #2
0
 public void Dispose()
 {
     try
     {
         if (!_cts.IsCancellationRequested)
         {
             _cts.Cancel();
         }
     }
     catch (Exception)
     {
         //Swallow
     }
     ;
     if (_lockHandle != null && _autoRelease)
     {
         _log.Information("Releasing lock {LockHandle}", _lockHandle);
         _lockHandle.ReleaseAsync(CancellationToken.None).GetAwaiter().GetResult();
     }
 }