Example #1
0
 private void ExitContext(ResourceHealthTracker.BudgetCostHandle context)
 {
     lock (this.syncRoot)
     {
         this.openedContexts.Pop();
         ResourceHealthTracker.BudgetCostHandle newContext = this.openedContexts.Peek();
         this.OpenOrCloseCostHandles(context, newContext);
     }
 }
Example #2
0
 private void EnterContext(ResourceHealthTracker.BudgetCostHandle context)
 {
     lock (this.syncRoot)
     {
         ResourceHealthTracker.BudgetCostHandle currentContext = this.openedContexts.Peek();
         this.openedContexts.Push(context);
         this.OpenOrCloseCostHandles(currentContext, context);
     }
 }
Example #3
0
 private void OpenOrCloseCostHandles(ResourceHealthTracker.BudgetCostHandle currentContext, ResourceHealthTracker.BudgetCostHandle newContext)
 {
     if (!currentContext.IsInclusive && newContext.IsInclusive)
     {
         this.StartCharging();
         return;
     }
     if (currentContext.IsInclusive && !newContext.IsInclusive)
     {
         this.StopCharging();
     }
 }