diff Implab/Promise.cs @ 249:d82909310094 v3

Implab.Test moved to xunit Complete set of PromiseHelpers (Then, Catch, Finally) Removed obsolete types ICancellable, ICancellationToken
author cin
date Wed, 31 Jan 2018 11:28:38 +0300
parents 5cb4826c2c2a
children 547a2fc0d93e
line wrap: on
line diff
--- a/Implab/Promise.cs	Tue Jan 30 01:37:17 2018 +0300
+++ b/Implab/Promise.cs	Wed Jan 31 11:28:38 2018 +0300
@@ -169,8 +169,7 @@
         public static IPromise<T> Create<T>(PromiseExecutor<T> executor) {
             Safe.ArgumentNotNull(executor, nameof(executor));
 
-            var p = new Promise<T>();
-            var d = new Deferred<T>(p, DefaultDispatcher);
+            var d = new Deferred<T>();
 
             try {
                 executor(d);
@@ -182,7 +181,7 @@
         }
 
         public static IPromise All(IEnumerable<IPromise> promises) {
-            var d = new Deferred(DefaultDispatcher);
+            var d = new Deferred();
             var all = new PromiseAll(d);
             foreach (var promise in promises) {
                 all.AddPromise(promise);
@@ -193,8 +192,8 @@
             return all.ResultPromise;
         }
 
-        public static IPromise<T[]> All<T>(IEnumerable<IPromise<T>> promises, Func<T, IPromise> cleanup, Action cancel) {
-            var d = new Deferred<T[]>(DefaultDispatcher);
+        public static IPromise<T[]> All<T>(IEnumerable<IPromise<T>> promises, Func<T, IPromise> cleanup = null, Action cancel = null) {
+            var d = new Deferred<T[]>();
             var all = new PromiseAll<T>(d, cleanup, cancel);
             foreach (var promise in promises) {
                 all.AddPromise(promise);