Index: /branches/Async/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Algorithms.Benchmarks/3.3/BenchmarkAlgorithm.cs	(revision 13349)
@@ -302,27 +302,34 @@
     }
     public void Start() {
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
       cancellationTokenSource = new CancellationTokenSource();
       OnStarted();
-      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
-      task.ContinueWith(t => {
-        try {
-          t.Wait();
-        }
-        catch (AggregateException ex) {
+      using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken)) {
+        Task task = Task.Factory.StartNew(Run, cts.Token, cts.Token);
+        await task.ContinueWith(t => {
           try {
-            ex.Flatten().Handle(x => x is OperationCanceledException);
+            t.Wait();
           }
-          catch (AggregateException remaining) {
-            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
-            else OnExceptionOccurred(remaining);
+          catch (AggregateException ex) {
+            try {
+              ex.Flatten().Handle(x => x is OperationCanceledException);
+            }
+            catch (AggregateException remaining) {
+              if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+              else OnExceptionOccurred(remaining);
+            }
           }
-        }
-
-        cancellationTokenSource.Dispose();
-        cancellationTokenSource = null;
-        OnStopped();
-      });
-    }
-
+
+          cancellationTokenSource.Dispose();
+          cancellationTokenSource = null;
+          OnStopped();
+        });
+      }
+    }
     private void Run(object state) {
       CancellationToken cancellationToken = (CancellationToken)state;
Index: /branches/Async/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs
===================================================================
--- /branches/Async/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs	(revision 13349)
@@ -216,5 +216,5 @@
 
     private void startButton_Click(object sender, EventArgs e) {
-      Content.Start();
+      Content.StartAsync();
     }
     private void pauseButton_Click(object sender, EventArgs e) {
Index: /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
===================================================================
--- /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs	(revision 13349)
@@ -25,4 +25,5 @@
 using System.Linq;
 using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Collections;
 using HeuristicLab.Common;
@@ -39,4 +40,6 @@
   [StorableClass]
   public sealed class CrossValidation : ParameterizedNamedItem, IAlgorithm, IStorableContent {
+    private readonly ManualResetEvent signaler = new ManualResetEvent(true);
+
     public CrossValidation()
       : base() {
@@ -265,64 +268,72 @@
       Prepare();
     }
-
     public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-
-      if (Algorithm != null) {
-        //create cloned algorithms
-        if (clonedAlgorithms.Count == 0) {
-          int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / Folds.Value;
-
-          for (int i = 0; i < Folds.Value; i++) {
-            IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone();
-            clonedAlgorithm.Name = algorithm.Name + " Fold " + i;
-            IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem;
-            ISymbolicDataAnalysisProblem symbolicProblem = problem as ISymbolicDataAnalysisProblem;
-
-            int testStart = (i * testSamplesCount) + SamplesStart.Value;
-            int testEnd = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value;
-
-            problem.ProblemData.TrainingPartition.Start = SamplesStart.Value;
-            problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
-            problem.ProblemData.TestPartition.Start = testStart;
-            problem.ProblemData.TestPartition.End = testEnd;
-            DataAnalysisProblemData problemData = problem.ProblemData as DataAnalysisProblemData;
-            if (problemData != null) {
-              problemData.TrainingPartitionParameter.Hidden = false;
-              problemData.TestPartitionParameter.Hidden = false;
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
+      signaler.Reset();
+      await Task.Run(() => {
+        if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
+          throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
+
+        if (Algorithm != null) {
+          //create cloned algorithms
+          if (clonedAlgorithms.Count == 0) {
+            int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / Folds.Value;
+
+            for (int i = 0; i < Folds.Value; i++) {
+              IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone();
+              clonedAlgorithm.Name = algorithm.Name + " Fold " + i;
+              IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem;
+              ISymbolicDataAnalysisProblem symbolicProblem = problem as ISymbolicDataAnalysisProblem;
+
+              int testStart = (i * testSamplesCount) + SamplesStart.Value;
+              int testEnd = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value;
+
+              problem.ProblemData.TrainingPartition.Start = SamplesStart.Value;
+              problem.ProblemData.TrainingPartition.End = SamplesEnd.Value;
+              problem.ProblemData.TestPartition.Start = testStart;
+              problem.ProblemData.TestPartition.End = testEnd;
+              DataAnalysisProblemData problemData = problem.ProblemData as DataAnalysisProblemData;
+              if (problemData != null) {
+                problemData.TrainingPartitionParameter.Hidden = false;
+                problemData.TestPartitionParameter.Hidden = false;
+              }
+
+              if (symbolicProblem != null) {
+                symbolicProblem.FitnessCalculationPartition.Start = SamplesStart.Value;
+                symbolicProblem.FitnessCalculationPartition.End = SamplesEnd.Value;
+              }
+              clonedAlgorithm.Prepare();
+              clonedAlgorithms.Add(clonedAlgorithm);
             }
-
-            if (symbolicProblem != null) {
-              symbolicProblem.FitnessCalculationPartition.Start = SamplesStart.Value;
-              symbolicProblem.FitnessCalculationPartition.End = SamplesEnd.Value;
-            }
-            clonedAlgorithm.Prepare();
-            clonedAlgorithms.Add(clonedAlgorithm);
           }
-        }
-
-        //start prepared or paused cloned algorithms
-        int startedAlgorithms = 0;
-        foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
-          if (startedAlgorithms < NumberOfWorkers.Value) {
-            if (clonedAlgorithm.ExecutionState == ExecutionState.Prepared ||
-                clonedAlgorithm.ExecutionState == ExecutionState.Paused) {
-
-              // start and wait until the alg is started 
-              using (var signal = new ManualResetEvent(false)) {
-                EventHandler signalSetter = (sender, args) => { signal.Set(); };
-                clonedAlgorithm.Started += signalSetter;
-                clonedAlgorithm.Start();
-                signal.WaitOne();
-                clonedAlgorithm.Started -= signalSetter;
-
-                startedAlgorithms++;
+
+          //start prepared or paused cloned algorithms
+          int startedAlgorithms = 0;
+          foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) {
+            if (startedAlgorithms < NumberOfWorkers.Value) {
+              if (clonedAlgorithm.ExecutionState == ExecutionState.Prepared ||
+                  clonedAlgorithm.ExecutionState == ExecutionState.Paused) {
+
+                // start and wait until the alg is started 
+                using (var signal = new ManualResetEvent(false)) {
+                  EventHandler signalSetter = (sender, args) => { signal.Set(); };
+                  clonedAlgorithm.Started += signalSetter;
+                  clonedAlgorithm.StartAsync(cancellationToken);
+                  signal.WaitOne();
+                  clonedAlgorithm.Started -= signalSetter;
+
+                  startedAlgorithms++;
+                }
               }
             }
           }
-        }
-        OnStarted();
-      }
+          OnStarted();
+        }
+      }, cancellationToken);
     }
 
@@ -671,5 +682,5 @@
           IAlgorithm preparedAlgorithm = clonedAlgorithms.FirstOrDefault(alg => alg.ExecutionState == ExecutionState.Prepared ||
                                                                                 alg.ExecutionState == ExecutionState.Paused);
-          if (preparedAlgorithm != null) preparedAlgorithm.Start();
+          if (preparedAlgorithm != null) preparedAlgorithm.StartAsync();
         }
         if (ExecutionState != ExecutionState.Stopped) {
@@ -714,4 +725,5 @@
       pausePending = false;
       ExecutionState = ExecutionState.Paused;
+      signaler.Set();
       EventHandler handler = Paused;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -726,4 +738,5 @@
       runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this));
       ExecutionState = ExecutionState.Stopped;
+      signaler.Set();
       EventHandler handler = Stopped;
       if (handler != null) handler(this, EventArgs.Empty);
Index: /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/FixedDataAnalysisAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/FixedDataAnalysisAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Algorithms.DataAnalysis/3.4/FixedDataAnalysisAlgorithm.cs	(revision 13349)
@@ -70,27 +70,29 @@
     }
 
-    public override void Start() {
-      base.Start();
+    public override async Task StartAsync(CancellationToken cancellationToken) {
+      await base.StartAsync(cancellationToken);
       var cancellationTokenSource = new CancellationTokenSource();
 
       OnStarted();
-      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
-      task.ContinueWith(t => {
-        try {
-          t.Wait();
-        }
-        catch (AggregateException ex) {
+      using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken)) {
+        Task task = Task.Factory.StartNew(Run, cts.Token, cts.Token);
+        await task.ContinueWith(t => {
           try {
-            ex.Flatten().Handle(x => x is OperationCanceledException);
+            t.Wait();
           }
-          catch (AggregateException remaining) {
-            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
-            else OnExceptionOccurred(remaining);
+          catch (AggregateException ex) {
+            try {
+              ex.Flatten().Handle(x => x is OperationCanceledException);
+            }
+            catch (AggregateException remaining) {
+              if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+              else OnExceptionOccurred(remaining);
+            }
           }
-        }
-        cancellationTokenSource.Dispose();
-        cancellationTokenSource = null;
-        OnStopped();
-      });
+          cancellationTokenSource.Dispose();
+          cancellationTokenSource = null;
+          OnStopped();
+        });
+      }
     }
     private void Run(object state) {
Index: /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs
===================================================================
--- /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs	(revision 13349)
@@ -81,5 +81,5 @@
     public override void Start() {
       Item.Prepare(initialOperation);
-      Item.Start();
+      Item.StartAsync();
     }
 
Index: /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs
===================================================================
--- /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs	(revision 13349)
@@ -101,5 +101,5 @@
         OnTaskStopped();
       } else {
-        Item.Start();
+        Item.StartAsync();
       }
     }
Index: /branches/Async/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBAlgorithmView.cs
===================================================================
--- /branches/Async/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBAlgorithmView.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Clients.OKB.Views/3.3/RunCreation/Views/OKBAlgorithmView.cs	(revision 13349)
@@ -325,5 +325,5 @@
     }
     private void startButton_Click(object sender, EventArgs e) {
-      Content.Start();
+      Content.StartAsync();
     }
     private void pauseButton_Click(object sender, EventArgs e) {
Index: /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/EmptyAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/EmptyAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/EmptyAlgorithm.cs	(revision 13349)
@@ -21,4 +21,6 @@
 
 using System;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -80,5 +82,5 @@
       throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot prepare an EmptyAlgorithm." : exceptionMessage);
     }
-    public override void Start() {
+    public override async Task StartAsync(CancellationToken cancellationToken) {
       throw new InvalidOperationException(string.IsNullOrEmpty(exceptionMessage) ? "Cannot start an EmptyAlgorithm." : exceptionMessage);
     }
Index: /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Clients.OKB/3.3/RunCreation/OKBAlgorithm.cs	(revision 13349)
@@ -25,4 +25,6 @@
 using System.IO;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Clients.Access;
 using HeuristicLab.Collections;
@@ -250,9 +252,15 @@
     }
     public void Start() {
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
       CheckUserPermissions();
       if (!ClientInformation.Instance.ClientExists && storeRunsAutomatically) {
         throw new MissingClientRegistrationException();
       }
-      Algorithm.Start();
+      await Algorithm.StartAsync(cancellationToken);
     }
     public void Pause() {
Index: /branches/Async/HeuristicLab.Core/3.3/Engine.cs
===================================================================
--- /branches/Async/HeuristicLab.Core/3.3/Engine.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Core/3.3/Engine.cs	(revision 13349)
@@ -82,28 +82,30 @@
     }
 
-    public override void Start() {
-      base.Start();
+    public override async Task StartAsync(CancellationToken cancellationToken) {
+      await base.StartAsync(cancellationToken);
       cancellationTokenSource = new CancellationTokenSource();
       stopPending = false;
-      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
-      task.ContinueWith(t => {
-        try {
-          t.Wait();
-        }
-        catch (AggregateException ex) {
+      using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken)) {
+        Task task = Task.Factory.StartNew(Run, cts.Token, cts.Token);
+        await task.ContinueWith(t => {
           try {
-            ex.Flatten().Handle(x => x is OperationCanceledException);
+            t.Wait();
           }
-          catch (AggregateException remaining) {
-            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
-            else OnExceptionOccurred(remaining);
+          catch (AggregateException ex) {
+            try {
+              ex.Flatten().Handle(x => x is OperationCanceledException);
+            }
+            catch (AggregateException remaining) {
+              if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+              else OnExceptionOccurred(remaining);
+            }
           }
-        }
-        cancellationTokenSource.Dispose();
-        cancellationTokenSource = null;
-        if (stopPending) executionStack.Clear();
-        if (executionStack.Count == 0) OnStopped();
-        else OnPaused();
-      });
+          cancellationTokenSource.Dispose();
+          cancellationTokenSource = null;
+          if (stopPending) executionStack.Clear();
+          if (executionStack.Count == 0) OnStopped();
+          else OnPaused();
+        });
+      }
     }
     protected override void OnStarted() {
Index: /branches/Async/HeuristicLab.Core/3.3/Executable.cs
===================================================================
--- /branches/Async/HeuristicLab.Core/3.3/Executable.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Core/3.3/Executable.cs	(revision 13349)
@@ -22,4 +22,6 @@
 using System;
 using System.Drawing;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Common;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -82,5 +84,11 @@
       ExecutionTime = TimeSpan.Zero;
     }
-    public virtual void Start() {
+    public void Start() {
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public virtual async Task StartAsync(CancellationToken cancellationToken) {
       if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
         throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
Index: /branches/Async/HeuristicLab.Core/3.3/Interfaces/IExecutable.cs
===================================================================
--- /branches/Async/HeuristicLab.Core/3.3/Interfaces/IExecutable.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Core/3.3/Interfaces/IExecutable.cs	(revision 13349)
@@ -21,4 +21,6 @@
 
 using System;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Common;
 
@@ -30,4 +32,6 @@
     void Prepare();
     void Start();
+    Task StartAsync();
+    Task StartAsync(CancellationToken cancellationToken);
     void Pause();
     void Stop();
Index: /branches/Async/HeuristicLab.DebugEngine/3.3/DebugEngine.cs
===================================================================
--- /branches/Async/HeuristicLab.DebugEngine/3.3/DebugEngine.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.DebugEngine/3.3/DebugEngine.cs	(revision 13349)
@@ -174,29 +174,31 @@
     }
 
-    public override void Start() {
-      base.Start();
+    public override async Task StartAsync(CancellationToken cancellationToken) {
+      await base.StartAsync(cancellationToken);
       cancellationTokenSource = new CancellationTokenSource();
       stopPending = false;
-      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
-      task.ContinueWith(t => {
-        try {
-          t.Wait();
-        }
-        catch (AggregateException ex) {
+      using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken)) {
+        Task task = Task.Factory.StartNew(Run, cts.Token, cts.Token);
+        await task.ContinueWith(t => {
           try {
-            ex.Flatten().Handle(x => x is OperationCanceledException);
+            t.Wait();
           }
-          catch (AggregateException remaining) {
-            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
-            else OnExceptionOccurred(remaining);
+          catch (AggregateException ex) {
+            try {
+              ex.Flatten().Handle(x => x is OperationCanceledException);
+            }
+            catch (AggregateException remaining) {
+              if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+              else OnExceptionOccurred(remaining);
+            }
           }
-        }
-        cancellationTokenSource.Dispose();
-        cancellationTokenSource = null;
-
-        if (stopPending) ExecutionStack.Clear();
-        if (stopPending || !CanContinue) OnStopped();
-        else OnPaused();
-      });
+          cancellationTokenSource.Dispose();
+          cancellationTokenSource = null;
+
+          if (stopPending) ExecutionStack.Clear();
+          if (stopPending || !CanContinue) OnStopped();
+          else OnPaused();
+        });
+      }
     }
 
Index: /branches/Async/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization.Views/3.3/IOptimizerView.cs	(revision 13349)
@@ -137,5 +137,5 @@
     #region Control events
     protected virtual void startButton_Click(object sender, EventArgs e) {
-      Content.Start();
+      Content.StartAsync();
     }
     protected virtual void pauseButton_Click(object sender, EventArgs e) {
Index: /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/Algorithm.cs	(revision 13349)
@@ -24,4 +24,6 @@
 using System.Drawing;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Collections;
 using HeuristicLab.Common;
@@ -202,5 +204,11 @@
       Prepare();
     }
-    public virtual void Start() {
+    public void Start() {
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public virtual async Task StartAsync(CancellationToken cancellationToken) {
       if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
         throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
Index: /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/BasicAlgorithm.cs	(revision 13349)
@@ -61,25 +61,29 @@
     }
 
-    public override void Start() {
-      base.Start();
+    public override async Task StartAsync(CancellationToken cancellationToken) {
+      await base.StartAsync(cancellationToken);
       CancellationTokenSource = new CancellationTokenSource();
 
       OnStarted();
-      Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token);
-      task.ContinueWith(t => {
-        try {
-          t.Wait();
-        } catch (AggregateException ex) {
+      using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationTokenSource.Token, cancellationToken)) {
+        Task task = Task.Factory.StartNew(Run, cts.Token, cts.Token);
+        await task.ContinueWith(t => {
           try {
-            ex.Flatten().Handle(x => x is OperationCanceledException);
-          } catch (AggregateException remaining) {
-            if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
-            else OnExceptionOccurred(remaining);
+            t.Wait();
           }
-        }
-        CancellationTokenSource.Dispose();
-        CancellationTokenSource = null;
-        OnStopped();
-      });
+          catch (AggregateException ex) {
+            try {
+              ex.Flatten().Handle(x => x is OperationCanceledException);
+            }
+            catch (AggregateException remaining) {
+              if (remaining.InnerExceptions.Count == 1) OnExceptionOccurred(remaining.InnerExceptions[0]);
+              else OnExceptionOccurred(remaining);
+            }
+          }
+          CancellationTokenSource.Dispose();
+          CancellationTokenSource = null;
+          OnStopped();
+        });
+      }
     }
 
@@ -106,5 +110,6 @@
       try {
         Run(cancellationToken);
-      } finally {
+      }
+      finally {
         timer.Elapsed -= new System.Timers.ElapsedEventHandler(timer_Elapsed);
         timer.Stop();
Index: /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs	(revision 13349)
@@ -22,8 +22,11 @@
 using System;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 using HeuristicLab.PluginInfrastructure;
+using ExecutionContext = HeuristicLab.Core.ExecutionContext;
 
 namespace HeuristicLab.Optimization {
@@ -168,7 +171,7 @@
       }
     }
-    public override void Start() {
-      base.Start();
-      if (engine != null) engine.Start();
+    public override async Task StartAsync(CancellationToken cancellationToken) {
+      await base.StartAsync(cancellationToken);
+      if (engine != null) await engine.StartAsync(cancellationToken);
     }
     public override void Pause() {
Index: /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/BatchRun.cs	(revision 13349)
@@ -23,4 +23,6 @@
 using System.Collections.Generic;
 using System.Drawing;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Collections;
 using HeuristicLab.Common;
@@ -39,4 +41,6 @@
   [StorableClass]
   public sealed class BatchRun : NamedItem, IOptimizer, IStorableContent {
+    private readonly ManualResetEvent signaler = new ManualResetEvent(true);
+
     public string Filename { get; set; }
 
@@ -244,12 +248,22 @@
     }
     public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizer == null) return;
-      batchRunAction = BatchRunAction.Start;
-      if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare();
-      // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-      try { Optimizer.Start(); }
-      catch (InvalidOperationException) { }
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
+      signaler.Reset();
+      await Task.Run(async () => {
+        if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
+          throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
+        if (Optimizer == null) return;
+        batchRunAction = BatchRunAction.Start;
+        if (Optimizer.ExecutionState == ExecutionState.Stopped) Optimizer.Prepare();
+        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+        try { await Optimizer.StartAsync(cancellationToken); }
+        catch (InvalidOperationException) { }
+        signaler.WaitOne();
+      }, cancellationToken);
     }
     public void Pause() {
@@ -326,4 +340,5 @@
       batchRunAction = BatchRunAction.None;
       ExecutionState = ExecutionState.Paused;
+      signaler.Set();
       EventHandler handler = Paused;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -333,4 +348,5 @@
       batchRunAction = BatchRunAction.None;
       ExecutionState = ExecutionState.Stopped;
+      signaler.Set();
       EventHandler handler = Stopped;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -397,5 +413,5 @@
       else if (batchRunAction == BatchRunAction.Start) {
         Optimizer.Prepare();
-        Optimizer.Start();
+        Optimizer.StartAsync();
       } else if (executionState == ExecutionState.Started) {
         // if the batch run hasn't been started but the inner optimizer was run then pause
Index: /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/Experiment.cs	(revision 13349)
@@ -25,4 +25,5 @@
 using System.Linq;
 using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Collections;
 using HeuristicLab.Common;
@@ -38,4 +39,6 @@
   [StorableClass]
   public sealed class Experiment : NamedItem, IOptimizer, IStorableContent {
+    private readonly ManualResetEvent signaler = new ManualResetEvent(true);
+
     public string Filename { get; set; }
 
@@ -186,16 +189,26 @@
     }
     public void Start() {
-      if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
-        throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
-      if (Optimizers.Count == 0) return;
-
-      experimentStarted = true;
-      experimentStopped = false;
-      IOptimizer optimizer = Optimizers.FirstOrDefault(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused));
-      if (optimizer != null) {
-        // a race-condition may occur when the optimizer has changed the state by itself in the meantime
-        try { optimizer.Start(); }
-        catch (InvalidOperationException) { }
-      }
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
+      signaler.Reset();
+      await Task.Run(async () => {
+        if ((ExecutionState != ExecutionState.Prepared) && (ExecutionState != ExecutionState.Paused))
+          throw new InvalidOperationException(string.Format("Start not allowed in execution state \"{0}\".", ExecutionState));
+        if (Optimizers.Count == 0) return;
+
+        experimentStarted = true;
+        experimentStopped = false;
+        IOptimizer optimizer = Optimizers.FirstOrDefault(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused));
+        if (optimizer != null) {
+          // a race-condition may occur when the optimizer has changed the state by itself in the meantime
+          try { await optimizer.StartAsync(cancellationToken); }
+          catch (InvalidOperationException) { }
+        }
+        signaler.WaitOne();
+      }, cancellationToken);
     }
     public void Pause() {
@@ -261,4 +274,5 @@
     private void OnPaused() {
       ExecutionState = ExecutionState.Paused;
+      signaler.Set();
       EventHandler handler = Paused;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -267,4 +281,5 @@
     private void OnStopped() {
       ExecutionState = ExecutionState.Stopped;
+      signaler.Set();
       EventHandler handler = Stopped;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -380,5 +395,5 @@
         } else {
           if (experimentStarted && Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused))) {
-            Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).Start();
+            Optimizers.First(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)).StartAsync();
           } else if (Optimizers.All(x => x.ExecutionState == ExecutionState.Stopped)) OnStopped();
           else if (Optimizers.Any(x => (x.ExecutionState == ExecutionState.Prepared) || (x.ExecutionState == ExecutionState.Paused)) && Optimizers.All(o => o.ExecutionState != ExecutionState.Started)) OnPaused();
Index: /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs
===================================================================
--- /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs	(revision 13349)
@@ -25,4 +25,5 @@
 using System.Drawing;
 using System.Linq;
+using System.Threading;
 using System.Threading.Tasks;
 using HeuristicLab.Collections;
@@ -40,4 +41,6 @@
   [StorableClass]
   public sealed class TimeLimitRun : NamedItem, IOptimizer, IStorableContent, INotifyPropertyChanged {
+    private readonly ManualResetEvent signaler = new ManualResetEvent(true);
+
     public string Filename { get; set; }
 
@@ -238,5 +241,15 @@
     }
     public void Start() {
-      Algorithm.Start();
+      StartAsync().Wait();
+    }
+    public async Task StartAsync() {
+      await StartAsync(new CancellationToken());
+    }
+    public async Task StartAsync(CancellationToken cancellationToken) {
+      signaler.Reset();
+      await Task.Run(async () => {
+        await Algorithm.StartAsync(cancellationToken);
+        signaler.WaitOne();
+      }, cancellationToken);
     }
     public void Pause() {
@@ -282,4 +295,5 @@
     public event EventHandler Paused;
     private void OnPaused() {
+      if (!pausedForSnapshot && !pausedForTermination) signaler.Set();
       var handler = Paused;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -287,4 +301,5 @@
     public event EventHandler Stopped;
     private void OnStopped() {
+      signaler.Set();
       var handler = Stopped;
       if (handler != null) handler(this, EventArgs.Empty);
@@ -336,11 +351,12 @@
     private void Algorithm_Paused(object sender, EventArgs e) {
       var action = pausedForTermination ? ExecutionState.Stopped : (pausedForSnapshot ? ExecutionState.Started : ExecutionState.Paused);
-      if (pausedForSnapshot || pausedForTermination) {
-        pausedForSnapshot = pausedForTermination = false;
+      bool pausedByLimit = pausedForSnapshot || pausedForTermination;
+      if (pausedByLimit) {
         MakeSnapshot();
         FindNextSnapshotTimeIndex(ExecutionTime);
       }
       OnPaused();
-      if (action == ExecutionState.Started) Algorithm.Start();
+      if (pausedByLimit) pausedForSnapshot = pausedForTermination = false;
+      if (action == ExecutionState.Started) Algorithm.StartAsync();
       else if (action == ExecutionState.Stopped) Algorithm.Stop();
     }
Index: /branches/Async/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSearch.cs
===================================================================
--- /branches/Async/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSearch.cs	(revision 13348)
+++ /branches/Async/HeuristicLab.Problems.QuadraticAssignment.Algorithms/3.3/RobustTabooSearch.cs	(revision 13349)
@@ -22,4 +22,6 @@
 using System;
 using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
 using HeuristicLab.Analysis;
 using HeuristicLab.Common;
@@ -338,5 +340,5 @@
     }
 
-    public override void Start() {
+    public override async Task StartAsync(CancellationToken cancellationToken) {
       if (ExecutionState == ExecutionState.Prepared) {
         int dim = Problem.Weights.Rows;
@@ -350,5 +352,5 @@
         GlobalScope.Variables.Add(new Variable("MoveQualityMatrix", new DoubleMatrix(dim, dim)));
       }
-      base.Start();
+      await base.StartAsync(cancellationToken);
     }
 
