예제 #1
0
 public override void ValidateEntryInvariants()
 {
     try
     {
         using var lck = FlagVault.SpinLock(TimeSpan.FromSeconds(2));
         if (lck.ShutdownCommandStatus?.StatusCode != CommandRequestStatusCode.Nil)
         {
             //bug 61 fix -- uncommented next line now rightly causes compilation error.
             //lck.Dispose();
             lck.ForceClearPowerDownStatus();
         }
     }
     catch (EntryInvariantsNotMetException)
     {
         throw;
     }
     catch (TimeoutException)
     {
         OnTimedOutGettingStatusLock();
     }
     catch (Exception e)
     {
         OnUnexpectedExceptionThrown(e);
     }
 }
예제 #2
0
 public override void ValidateEntryInvariants()
 {
     using var lck = FlagVault.SpinLock(TimeSpan.FromSeconds(2));
     if (lck.IsEmpty)
     {
         throw new EntryInvariantsNotMetException(LaundryMachineStateCode.Full, "To be full, the laundry machine needs to have laundry in it.");
     }
 }