Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15212


Ignore:
Timestamp:
07/12/17 16:07:08 (7 years ago)
Author:
jkarder
Message:

#2258: worked on execution of cross-validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r15204 r15212  
    256256
    257257    public void Prepare() {
     258      if (startPending) return;
    258259      if (ExecutionState == ExecutionState.Started)
    259260        throw new InvalidOperationException(string.Format("Prepare not allowed in execution state \"{0}\".", ExecutionState));
     
    270271    }
    271272
     273    private bool startPending;
    272274    public void Start() {
    273275      Start(CancellationToken.None);
    274276    }
    275277    public void Start(CancellationToken cancellationToken) {
     278      lock (locker) {
     279        if (startPending) return;
     280        startPending = true;
     281      }
     282
    276283      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
    277284        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
     
    337344    private bool pausePending;
    338345    public void Pause() {
     346      if (startPending) return;
    339347      if (ExecutionState != ExecutionState.Started)
    340348        throw new InvalidOperationException(string.Format("Pause not allowed in execution state \"{0}\".", ExecutionState));
     
    353361    private bool stopPending;
    354362    public void Stop() {
     363      if (startPending) return;
    355364      if ((ExecutionState != ExecutionState.Started) && (ExecutionState != ExecutionState.Paused))
    356365        throw new InvalidOperationException(string.Format("Stop not allowed in execution state \"{0}\".",
     
    716725    public event EventHandler Started;
    717726    private void OnStarted() {
     727      startPending = false;
    718728      ExecutionState = ExecutionState.Started;
    719729      EventHandler handler = Started;
Note: See TracChangeset for help on using the changeset viewer.