Changeset 6188 for trunk/sources/HeuristicLab.Problems.ExternalEvaluation
- Timestamp:
- 05/12/11 15:38:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.ExternalEvaluation/3.3/EvaluationCache.cs
r6183 r6188 74 74 private LinkedList<CacheEntry> list; 75 75 private Dictionary<CacheEntry, LinkedListNode<CacheEntry>> index; 76 private staticHashSet<string> activeEvaluations = new HashSet<string>();77 private staticobject cacheLock = new object();78 private staticobject evaluationLock = new object();79 private staticAutoResetEvent evaluationDone = new AutoResetEvent(false);76 private HashSet<string> activeEvaluations = new HashSet<string>(); 77 private object cacheLock = new object(); 78 private object evaluationLock = new object(); 79 private AutoResetEvent evaluationDone = new AutoResetEvent(false); 80 80 #endregion 81 81 … … 250 250 Monitor.Exit(evaluationLock); 251 251 OnActiveEvalutionsChanged(); 252 entry.Value = evaluate(message); 253 lock (cacheLock) { 254 index[entry] = list.AddLast(entry); 252 try { 253 entry.Value = evaluate(message); 254 lock (cacheLock) { 255 index[entry] = list.AddLast(entry); 256 } 257 Trim(); 258 } finally { 259 lock (evaluationLock) { 260 activeEvaluations.Remove(entry.Key); 261 evaluationDone.Set(); 262 } 263 OnActiveEvalutionsChanged(); 255 264 } 256 lock (evaluationLock) {257 activeEvaluations.Remove(entry.Key);258 evaluationDone.Set();259 }260 OnActiveEvalutionsChanged();261 Trim();262 265 return entry.Value; 263 266 }
Note: See TracChangeset
for help on using the changeset viewer.