Changeset 8170
- Timestamp:
- 06/30/12 18:09:56 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization/3.3/Experiment.cs
r8136 r8170 326 326 optimizer.Runs.ItemsRemoved -= new CollectionItemsChangedEventHandler<IRun>(optimizer_Runs_ItemsRemoved); 327 327 } 328 329 private readonly object locker = new object(); 328 330 private void optimizer_ExceptionOccurred(object sender, EventArgs<Exception> e) { 329 OnExceptionOccurred(e.Value); 331 lock (locker) 332 OnExceptionOccurred(e.Value); 330 333 } 331 334 private void optimizer_ExecutionTimeChanged(object sender, EventArgs e) { 332 ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime); 335 lock (locker) 336 ExecutionTime = Optimizers.Aggregate(TimeSpan.Zero, (t, o) => t + o.ExecutionTime); 333 337 } 334 338 private void optimizer_Paused(object sender, EventArgs e) { 335 if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused(); 339 lock (locker) 340 if (Optimizers.All(x => x.ExecutionState != ExecutionState.Started)) OnPaused(); 336 341 } 337 342 private void optimizer_Prepared(object sender, EventArgs e) { 338 if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared(); 343 lock (locker) 344 if (Optimizers.All(x => x.ExecutionState == ExecutionState.Prepared)) OnPrepared(); 339 345 } 340 346 private void optimizer_Started(object sender, EventArgs e) { 341 if (ExecutionState != ExecutionState.Started) OnStarted(); 342 } 343 344 private readonly object locker = new object(); 347 lock (locker) 348 if (ExecutionState != ExecutionState.Started) OnStarted(); 349 } 345 350 private void optimizer_Stopped(object sender, EventArgs e) { 346 351 lock (locker) { … … 356 361 } 357 362 private void optimizer_Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 358 Runs.RemoveRange(e.OldItems); 359 Runs.AddRange(e.Items); 363 lock (locker) { 364 Runs.RemoveRange(e.OldItems); 365 Runs.AddRange(e.Items); 366 } 360 367 } 361 368 private void optimizer_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IRun> e) { 362 Runs.AddRange(e.Items); 369 lock (locker) 370 Runs.AddRange(e.Items); 363 371 } 364 372 private void optimizer_Runs_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IRun> e) { 365 Runs.RemoveRange(e.Items); 373 lock (locker) 374 Runs.RemoveRange(e.Items); 366 375 } 367 376
Note: See TracChangeset
for help on using the changeset viewer.