Changeset 13000 for trunk/sources
- Timestamp:
- 10/14/15 10:57:49 (9 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/crossvalidation-2434 (added) merged: 12949-12950
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Optimization
- Property svn:mergeinfo changed
/branches/crossvalidation-2434/HeuristicLab.Optimization (added) merged: 12949-12950
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
r12504 r13000 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Threading; 26 27 using HeuristicLab.Collections; 27 28 using HeuristicLab.Common; … … 345 346 346 347 private readonly object locker = new object(); 348 private readonly object runsLocker = new object(); 347 349 private void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) { 348 350 lock (locker) … … 350 352 } 351 353 private void optimizer_ExecutionTimeChanged(object sender, EventArgs e) { 352 lock (locker) 354 // only wait for maximally 100ms to acquire lock, otherwise return and don't update the execution time 355 var success = Monitor.TryEnter(locker, 100); 356 if (!success) return; 357 try { 353 358 ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime); 359 } 360 finally { 361 Monitor.Exit(locker); 362 } 354 363 } 355 364 private void optimizer_Paused(object sender, EventArgs e) { … … 378 387 } 379 388 private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 380 lock ( locker) {389 lock (runsLocker) { 381 390 Runs.RemoveRange(e.OldItems); 382 391 Runs.AddRange(e.Items); … … 384 393 } 385 394 private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) { 386 lock ( locker)395 lock (runsLocker) 387 396 Runs.AddRange(e.Items); 388 397 } 389 398 private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { 390 lock ( locker)399 lock (runsLocker) 391 400 Runs.RemoveRange(e.Items); 392 401 }
Note: See TracChangeset
for help on using the changeset viewer.