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(); }
public bool SetGlobalData(string key, string value) { return(GenericData.SetGlobalData(key, value)); }