public long GetRemainingValue(LimitableResource resource) { int index = GetIndex(resource); lock (_lockObj) { return(_limit[index] - _current[index]); } }
public long GetCurrentValue(LimitableResource resource) { int index = GetIndex(resource); lock (_lock) { return(_current[index]); } }
public long GetRemainingValue(LimitableResource Resource) { int Index = GetIndex(Resource); lock (LockObj) { return(Limit[Index] - Current[Index]); } }
public long GetPeakValue(LimitableResource resource) { int index = GetIndex(resource); lock (_lock) { return(_peak[index]); } }
public KernelResult GetResourceLimitCurrentValue32([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out int limitValueLow, [R(2)] out int limitValueHigh) { KernelResult result = _syscall.GetResourceLimitCurrentValue(out long limitValue, handle, resource); limitValueHigh = (int)(limitValue >> 32); limitValueLow = (int)(limitValue & uint.MaxValue); return(result); }
public KernelResult GetResourceLimitPeakValue32([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out int peakLow, [R(2)] out int peakHigh) { KernelResult result = _syscall.GetResourceLimitPeakValue(out long peak, handle, resource); peakHigh = (int)(peak >> 32); peakLow = (int)(peak & uint.MaxValue); return(result); }
public bool Reserve(LimitableResource resource, long amount, long timeout) { long endTimePoint = KTimeManager.ConvertNanosecondsToMilliseconds(timeout); endTimePoint += PerformanceCounter.ElapsedMilliseconds; bool success = false; int index = GetIndex(resource); lock (_lock) { if (_current2[index] >= _limit[index]) { return(false); } long newCurrent = _current[index] + amount; while (newCurrent > _limit[index] && _current2[index] + amount <= _limit[index]) { _waitingThreadsCount++; KConditionVariable.Wait(KernelContext, _waitingThreads, _lock, timeout); _waitingThreadsCount--; newCurrent = _current[index] + amount; if (timeout >= 0 && PerformanceCounter.ElapsedMilliseconds > endTimePoint) { break; } } if (newCurrent <= _limit[index]) { _current[index] = newCurrent; _current2[index] += amount; if (_current[index] > _peak[index]) { _peak[index] = _current[index]; } success = true; } } return(success); }
public void Release(LimitableResource resource, long amount, long amount2) { int index = GetIndex(resource); lock (_lock) { _current[index] -= amount; _current2[index] -= amount2; if (_waitingThreadsCount > 0) { KConditionVariable.NotifyAll(KernelContext, _waitingThreads); } } }
private void Release(LimitableResource resource, long usedAmount, long availableAmount) { int index = GetIndex(resource); lock (_lockObj) { _current [index] -= usedAmount; _available[index] -= availableAmount; if (_waitingThreadsCount > 0) { KConditionVariable.NotifyAll(_system, _waitingThreads); } } }
private void Release(LimitableResource Resource, long UsedAmount, long AvailableAmount) { int Index = GetIndex(Resource); lock (LockObj) { Current [Index] -= UsedAmount; Available[Index] -= AvailableAmount; if (WaitingThreadsCount > 0) { KConditionVariable.NotifyAll(System, WaitingThreads); } } }
public KernelResult SetLimitValue(LimitableResource Resource, long Limit) { int Index = GetIndex(Resource); lock (LockObj) { if (Current[Index] <= Limit) { this.Limit[Index] = Limit; return(KernelResult.Success); } else { return(KernelResult.InvalidState); } } }
public KernelResult SetLimitValue(LimitableResource resource, long limit) { int index = GetIndex(resource); lock (_lockObj) { if (_current[index] <= limit) { _limit[index] = limit; return(KernelResult.Success); } else { return(KernelResult.InvalidState); } } }
public bool Reserve(LimitableResource Resource, long Amount, long Timeout) { long EndTimePoint = KTimeManager.ConvertNanosecondsToMilliseconds(Timeout); EndTimePoint += PerformanceCounter.ElapsedMilliseconds; bool Success = false; int Index = GetIndex(Resource); lock (LockObj) { long NewCurrent = Current[Index] + Amount; while (NewCurrent > Limit[Index] && Available[Index] + Amount <= Limit[Index]) { WaitingThreadsCount++; KConditionVariable.Wait(System, WaitingThreads, LockObj, Timeout); WaitingThreadsCount--; NewCurrent = Current[Index] + Amount; if (Timeout >= 0 && PerformanceCounter.ElapsedMilliseconds > EndTimePoint) { break; } } if (NewCurrent <= Limit[Index]) { Current[Index] = NewCurrent; Success = true; } } return(Success); }
public KernelResult GetResourceLimitCurrentValue64([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out long limitValue) { return(_syscall.GetResourceLimitCurrentValue(handle, resource, out limitValue)); }
public void Release(LimitableResource Resource, long Amount) { Release(Resource, Amount, Amount); }
public void Release(LimitableResource Resource, ulong Amount) { Release(Resource, (long)Amount); }
public bool Reserve(LimitableResource Resource, long Amount) { return(Reserve(Resource, Amount, KTimeManager.ConvertMillisecondsToNanoseconds(Time10SecondsMs))); }
public bool Reserve(LimitableResource Resource, ulong Amount) { return(Reserve(Resource, (long)Amount)); }
private static int GetIndex(LimitableResource Resource) { return((int)Resource); }
public bool Reserve(LimitableResource resource, long amount) { return(Reserve(resource, amount, KTimeManager.ConvertMillisecondsToNanoseconds(DefaultTimeoutMs))); }
public KernelResult GetResourceLimitPeakValue64([R(1)] int handle, [R(2)] LimitableResource resource, [R(1)] out long peak) { return(_syscall.GetResourceLimitPeakValue(handle, resource, out peak)); }
public bool Reserve(LimitableResource resource, ulong amount) { return(Reserve(resource, (long)amount)); }
public void Release(LimitableResource resource, long amount) { Release(resource, amount, amount); }
public void Release(LimitableResource resource, ulong amount) { Release(resource, (long)amount); }
public KernelResult SetResourceLimitLimitValue64([R(0)] int handle, [R(1)] LimitableResource resource, [R(2)] long limitValue) { return(_syscall.SetResourceLimitLimitValue(handle, resource, limitValue)); }
public KernelResult SetResourceLimitLimitValue32([R(0)] int handle, [R(1)] LimitableResource resource, [R(2)] uint limitValueLow, [R(3)] uint limitValueHigh) { long limitValue = (long)(limitValueLow | ((ulong)limitValueHigh << 32)); return(_syscall.SetResourceLimitLimitValue(handle, resource, limitValue)); }