Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/13/17 15:53:56 (7 years ago)
Author:
jkarder
Message:

#2258: worked on exception handling

Location:
branches/Async/HeuristicLab.Optimization/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/Async/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs

    r15065 r15232  
    213213    public virtual async Task StartAsync() { await StartAsync(CancellationToken.None); }
    214214    public virtual async Task StartAsync(CancellationToken cancellationToken) {
    215       await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken);
     215      await AsyncHelper.DoAsync(Start, cancellationToken);
    216216    }
    217217    public virtual void Pause() {
  • branches/Async/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs

    r15215 r15232  
    2121
    2222using System;
     23using System.Linq;
    2324using System.Threading;
    2425using HeuristicLab.Common;
     
    6970      } catch (OperationCanceledException) {
    7071      } catch (AggregateException ae) {
    71         if (ae.InnerExceptions.Count == 1) OnExceptionOccurred(ae.InnerExceptions[0]);
    72         else OnExceptionOccurred(ae);
     72        OnExceptionOccurred(ae.InnerExceptions.SingleOrDefault() ?? ae);
    7373      } catch (Exception e) {
    7474        OnExceptionOccurred(e);
  • branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs

    r15065 r15232  
    262262    public async Task StartAsync() { await StartAsync(CancellationToken.None); }
    263263    public async Task StartAsync(CancellationToken cancellationToken) {
    264       await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken);
     264      await AsyncHelper.DoAsync(Start, cancellationToken);
    265265    }
    266266    public void Pause() {
  • branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs

    r15065 r15232  
    204204    public async Task StartAsync() { await StartAsync(CancellationToken.None); }
    205205    public async Task StartAsync(CancellationToken cancellationToken) {
    206       await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken);
     206      await AsyncHelper.DoAsync(Start, cancellationToken);
    207207    }
    208208    public void Pause() {
  • branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs

    r15065 r15232  
    246246    public async Task StartAsync() { await StartAsync(CancellationToken.None); }
    247247    public async Task StartAsync(CancellationToken cancellationToken) {
    248       await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken);
     248      await AsyncHelper.DoAsync(Start, cancellationToken);
    249249    }
    250250    public void Pause() {
Note: See TracChangeset for help on using the changeset viewer.