Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/02/11 04:05:04 (14 years ago)
Author:
swagner
Message:

Worked on cancellation and refactored code (#1333)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ParallelEngine/HeuristicLab.Core/3.3/Engine.cs

    r5185 r5187  
    9393        }
    9494        catch (AggregateException ex) {
    95           ex.Flatten().Handle(x => {
    96             if (!(x is OperationCanceledException)) OnExceptionOccurred(x);
    97             return true;
    98           });
     95          try {
     96            ex.Flatten().Handle(x => x is OperationCanceledException);
     97          }
     98          catch (AggregateException remaining) {
     99            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
     100            else OnExceptionOccurred(remaining);
     101          }
    99102        }
    100103        cancellationTokenSource.Dispose();
    101104        cancellationTokenSource = null;
    102         if (stopRequested) {
    103           executionStack.Clear();
    104           OnStopped();
    105         } else {
    106           if (executionStack.Count == 0) OnStopped();
    107           else OnPaused();
    108         }
     105        if (stopRequested) executionStack.Clear();
     106        if (executionStack.Count == 0) OnStopped();
     107        else OnPaused();
    109108      });
    110109    }
Note: See TracChangeset for help on using the changeset viewer.