Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/17 14:08:52 (7 years ago)
Author:
pfleck
Message:

#2822 Added parallel execution support for Experiment (similar to CrossValidation).

  • Fixed race-condition in BasicAlgorithm (potential NullReference of CancellationTokenSource).
  • Fixed race-condition in BatchRun (calling .Stop potentially fires both OnStopped and OnPaused).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParallelExperiment/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r15302 r15337  
    8080      try {
    8181        Run((object)cancellationTokenSource.Token);
    82       }
    83       catch (OperationCanceledException) {
    84       }
    85       catch (AggregateException ae) {
     82      } catch (OperationCanceledException) {
     83      } catch (AggregateException ae) {
    8684        OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
    87       }
    88       catch (Exception e) {
     85      } catch (Exception e) {
    8986        OnExceptionOccurred(e);
    9087      }
     
    104101      base.Pause();
    105102      pausePending = true;
    106       CancellationTokenSource.Cancel();
     103      CancellationTokenSource?.Cancel();
    107104    }
    108105
     
    112109      base.Stop();
    113110      if (ExecutionState == ExecutionState.Paused) OnStopped();
    114       else CancellationTokenSource.Cancel();
     111      else CancellationTokenSource?.Cancel();
    115112    }
    116113
     
    127124        initialized = true;
    128125        Run(cancellationToken);
    129       }
    130       finally {
     126      } finally {
    131127        timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
    132128        timer.Stop();
Note: See TracChangeset for help on using the changeset viewer.