Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/23/15 21:18:26 (8 years ago)
Author:
jkarder
Message:

#2258: added StartAsync to IExecutable

File:
1 edited

Legend:

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

    r12012 r13349  
    2424using System.Drawing;
    2525using System.Linq;
     26using System.Threading;
     27using System.Threading.Tasks;
    2628using HeuristicLab.Collections;
    2729using HeuristicLab.Common;
     
    202204      Prepare();
    203205    }
    204     public virtual void Start() {
     206    public void Start() {
     207      StartAsync().Wait();
     208    }
     209    public async Task StartAsync() {
     210      await StartAsync(new CancellationToken());
     211    }
     212    public virtual async Task StartAsync(CancellationToken cancellationToken) {
    205213      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
    206214        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
Note: See TracChangeset for help on using the changeset viewer.