public void GetGlobalData(string key) { var data = GenericData.GetGlobalData(key); Response.BodyWriter.WriteAsync(data); Response.CompleteAsync(); return; }
public void IncrementGlobalData(string key, double changeAmount) { PerformanceTracker pt = new PerformanceTracker("IncrementGlobalData"); locks.TryAdd(key, new ReaderWriterLockSlim()); var thisLock = locks[key]; thisLock.EnterWriteLock(); var data = GenericData.GetGlobalData(key); double val = 0; Double.TryParse(data.ToString(), out val); val += changeAmount; GenericData.SetGlobalData(key, val.ToString()); thisLock.ExitWriteLock(); if (thisLock.WaitingWriteCount == 0) { locks.TryRemove(key, out thisLock); } pt.Stop(); }