Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/17 09:45:36 (7 years ago)
Author:
jkarder
Message:

#2258: refactored async methods

  • synchronously called IExecutables are now executed in the caller's thread
  • removed old synchronization code from unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs

    r13354 r15065  
    252252    }
    253253    public void Start() {
    254       StartAsync().Wait();
    255     }
    256     public async Task StartAsync() {
    257       await StartAsync(CancellationToken.None);
    258     }
    259     public async Task StartAsync(CancellationToken cancellationToken) {
     254      Start(CancellationToken.None);
     255    }
     256    public void Start(CancellationToken cancellationToken) {
    260257      CheckUserPermissions();
    261258      if (!ClientInformation.Instance.ClientExists && storeRunsAutomatically) {
    262259        throw new MissingClientRegistrationException();
    263260      }
    264       await Algorithm.StartAsync(cancellationToken);
     261      Algorithm.Start(cancellationToken);
     262    }
     263    public async Task StartAsync() { await StartAsync(CancellationToken.None); }
     264    public async Task StartAsync(CancellationToken cancellationToken) {
     265      await Task.Factory.StartNew((ct) => Start((CancellationToken)ct), cancellationToken, cancellationToken);
    265266    }
    266267    public void Pause() {
Note: See TracChangeset for help on using the changeset viewer.